numerical sort
numerical sort

<script type="text/javascript">
$(document).ready(function () {
$("#DTable").dataTable({
"pageLength": 30,
"lengthMenu": [ 10, 25, 30, 50, 75, 100 ],
"bFilter": false,
"aaSorting": [[ 0, 'asc' ]],
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": true },
]
});
});
</script>
How do I get the first and third columns to sort numerically please - thanks
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
If they're numeric, that would happen automatically. If not, it would suggest a non-numeric value is in one of the cells.
If that doesn't help resolve it, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
'''
The table looks like
<
table id="DTable" border="0" width="100%" cellspacing="0" cellpadding="4">
<thead>
<tr>
<td bgcolor="#F2F2F2" style="width: 2px">
<h3>ID</h3>
</td>
<td bgcolor="#F2F2F2" style="width: 821px">
<h3>Question</h3>
</td>
<td bgcolor="#F2F2F2" width="150">
<h3>Status</h3>
</td>
</tr>
</thead>
AH is it because there is an
<
h3> and an <a>. How do I get round that?
Checkout the Natural sorring plugin. It can remove the HTML for sorting purposes.
Kevin
I will try that now - thanks
Aha
That worked if I used the latest version of Datatables - thanks