Note that there are some explanatory texts on larger screens.

plurals
  1. POServer-side processing jquery datatables in Zend Framework
    primarykey
    data
    text
    <p>I'm trying to work with datatables and server-side processing. This is what I have in my view:</p> <pre><code>&lt;table id="datatables" class="display"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Your Name&lt;/th&gt; &lt;th&gt;Date and Time&lt;/th&gt; &lt;th&gt;Actions&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;script&gt; $(document).ready( function () { // DATATABLES CONFIGURATION $('#datatables').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "results/loadReportsAction" } ); }); &lt;/script&gt; </code></pre> <p>In my ResultsController :</p> <pre><code>public function loadReportsAction() { $this-&gt;_helper-&gt;layout-&gt;disableLayout(); $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender(); $row = array(); $output = array( "iTotalRecords" =&gt; 34, "iTotalDisplayRecords" =&gt; 34, "aaData" =&gt; array() ); $sessions = SessionQuery::create()-&gt;findByQuizId(3); foreach($sessions as $session){ $row[] = "test"; $row[] = "test2"; $row[] = "test3"; $output['aaData'][] = $row; $row = array(); } echo json_encode( $output ); } </code></pre> <p>As you can see I just try to load strings like "test", "test2", ... .<br> I first want to make the data loading right and then create the filtering, sorting, ... .</p> <p>When I load this I just get this error: </p> <blockquote> <p>DataTables warning (table id = 'datatables'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.</p> </blockquote> <p>This is what I get in my response:</p> <p><img src="https://i.stack.imgur.com/GhKWI.png" alt="enter image description here"></p> <p>Or check it <a href="http://pastebin.com/HUYtpWYR" rel="nofollow noreferrer">here</a> .</p> <p>He just shows the existing HTML but not the json that was sent.</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. This table or related slice is empty.
    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