Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to pass data manually to datatables
    primarykey
    data
    text
    <p>I am trying datatables. I successfully tried on ajax call. But now I am looking for loading my data grid, using datatables of course, on page load.</p> <p>I need to pass arguments to my processing page via querystring. Page does the operation and then a template file shows the datagrid. This all was being done in smarty using manual foreach and other loops. Now I want to convert it all to datatables. </p> <p>But how that initial data is going be passed to datatables? Therefore I need to pass initial data to datatables, but how? I referred to datatables api and other references but did not any such thing. Please help</p> <p>I wish to do something like this</p> <pre><code>&lt;?php //get params from $_GET $dbRet = someDbOps($someGetParams); //db processing include_once('grid.tpl'); ?&gt; </code></pre> <p>on grid.tpl</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="jq.js"&gt;&lt;/script&gt; &lt;script src="datatables.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; var data = '&lt;?php echo $dbRet?&gt;'; //now i got data here $('#one-column-emphasis').dataTable({ "bProcessing" : true, "bServerSide" : true, "sAjaxSource" : "changeLog.php", "bPaginate" : true, "aoColumns" : [ "Topic", "Details", "Date" ], "aaSorting" : [[1,"desc"]] }); // how to pass $dbRet to this handler???? &lt;/script&gt; &lt;table id="one-column-emphasis"&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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