problem sorting in FixedColumns

problem sorting in FixedColumns

mephjlmephjl Posts: 4Questions: 0Answers: 0
edited December 2012 in General
I all,

this is my simple code :


$(document).ready( function () {
var oTable = $('#tabella5').dataTable( {
"sScrollX": "100%",
"sScrollXInner": "120%",
"bScrollCollapse": true
} );
new FixedColumns( oTable, {
"iLeftColumns": 2,
"iLeftWidth": 250
} );
} );


it sorting well when table not contains tags, for example like this :




<?php echo number_format($var1,2);?>
<?php echo number_format($var2,2);?>
.....
.....



vars are percentuals.

but it don't sort columns when I add any HTML tags in TD tags like this :


<?php echo number_format($var1,2);?>
<?php echo number_format($var2,2);?>
.....
.....




Can anyone tell me why ?

TNX ALL

Replies

  • ulrikeulrike Posts: 39Questions: 1Answers: 0
    When adding tags, afaiu, datatables will interpret your TD contents as a string.

    You will probably need to force natural or numeric sorting on your columns.

    See http://datatables.net/release-datatables/examples/basic_init/table_sorting.html and http://datatables.net/plug-ins/sorting
  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    Absolutely spot on :-) .

    @mephjl - look at the Numbers with HTML plug-in.

    Allan
This discussion has been closed.