Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Datatables Ajax method cell alignment
    primarykey
    data
    text
    <p>I am displaying the database table values using data tables. I am doing this using the ajax method. Here is the code</p> <pre><code>$('#example1').dataTable( { "bProcessing": true, "sAjaxSource": "filename.php", "bJQueryUI": true, "sPaginationType": "full_numbers" } ); </code></pre> <p>The output of the filename.php is </p> <pre><code>{ "aaData": [["1","&lt;input type='checkbox' name='user'&gt;&amp;nbsp;Test Name","Leader","35"]] } </code></pre> <p>The html code is</p> <pre><code>&lt;table cellpadding="0" cellspacing="0" border="0" class="display tablehead" id="example1"&gt; &lt;thead&gt; &lt;tr class="colhead newbg"&gt; &lt;th width="17" align="center"&gt;No&lt;/th&gt; &lt;th width="194" align="left"&gt;User&lt;/th&gt; &lt;th width="56" align="left"&gt;Role&lt;/th&gt; &lt;th width="31" align="right"&gt;AGE&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>In the above html you can see the first column is center aligned and the next two columns are left aligned and the last one is right aligned. But in the data out put all are center aligned. I tried to use the following</p> <pre><code>{ "aaData": [["&lt;div align='center'&gt;1&lt;/div&gt;","&lt;div align='left'&gt;&lt;input type='checkbox' name='user'&gt;&amp;nbsp;Test Name&lt;/div&gt;","&lt;div align='center'&gt;Leader&lt;/div&gt;","&lt;div align='right'&gt;35&lt;/div&gt;"]] } </code></pre> <p>Now i got the correct display but while sorting by age it is not correct. Please help. Thanks</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.
 

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