Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks like there's a problem with the data that you're putting in the ItemFileReadStore.</p> <p>Here are a few pointers.</p> <p>Consider extending Zend_Rest_Controller for your services. It'll be easier to manage your contexts and your views. You'll be able to do something like this:</p> <pre><code>public function init() { $ajaxContext = $this-&gt;_helper-&gt;getHelper('AjaxContext'); $ajaxContext-&gt;addActionContexts(array( 'gservice' =&gt; 'json' )); } </code></pre> <p>And it will eliminate the need for the following in each of you service actions.</p> <pre><code>// disable layout and view rendering $this-&gt;_helper-&gt;layout-&gt;disableLayout(); $this-&gt;getHelper('viewRenderer')-&gt;setNoRender(true); </code></pre> <p>You'll need to either pass the format parameter or use the following plugin to help with the context switch. Passing the format parameter is simpler but it pollutes the url with ?format=json. Here's the <a href="http://framework.zend.com/manual/en/zend.controller.actionhelpers.html" rel="nofollow">Zend documentation on AjaxContext</a>.</p> <p>Here's a plugin that you can use if you don't want to pass the format parameter.</p> <pre><code>class Application_Plugin_AcceptHandler extends Zend_Controller_Plugin_Abstract { public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) { if (!$request instanceof Zend_Controller_Request_Http) { return; } $header = $request-&gt;getHeader('Accept'); switch (true) { case (strstr($header, 'application/json')): Zend_Registry::get('logger')-&gt;log('Setting format to json', Zend_Log::INFO); $request-&gt;setParam('format', 'json'); break; case (strstr($header, 'application/xml') &amp;&amp; (!strstr($header, 'html'))): Zend_Registry::get('logger')-&gt;log('Setting format to xml', Zend_Log::INFO); $request-&gt;setParam('format', 'xml'); break; default: Zend_Registry::get('logger')-&gt;log('Setting format to html', Zend_Log::INFO); break; } } } </code></pre> <p>In your controller, instead of echoing the data, create view variables that dojo expects. See this <a href="http://dojotoolkit.org/reference-guide/quickstart/data/usingdatastores/simple.html#quickstart-data-usingdatastores-simple" rel="nofollow">document</a> for the format.</p> <pre><code>$this-&gt;view-&gt;model = (object) array(); $this-&gt;view-&gt;model-&gt;identifier = 'id'; $this-&gt;view-&gt;model-&gt;label = 'name'; $this-&gt;view-&gt;model-&gt;items = array(); </code></pre> <p>In your controller, fetch your table rows:</p> <pre><code>$tableRows = $this-&gt;dbTable-&gt;fetchAll($select); </code></pre> <p>or, if you've put model code in a function, it might look more like:</p> <pre><code>$tableRows = $this-&gt;dbTable-&gt;fetchGroomProcedures(); </code></pre> <p>Put your row data in the model->items[] array:</p> <pre><code>foreach ($tableRows as $row) { $this-&gt;view-&gt;model-&gt;items[] = $row-&gt;toArray(); } </code></pre> <p>Create a view, view/scripts/appointment/gservice.json.phtml and in it put</p> <pre><code>Zend_Json::encode($this-&gt;model) </code></pre> <p>Use Firebug to see what is returned from your service.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload