Saturday, 15 May 2010

javascript - Datatables fnSort advise -



javascript - Datatables fnSort advise -

looking help place fnsort datatables code create default sort sec column opposed first. have:

dataclones['keyword_table_<?php echo ceil($countcallscounter/7); ?>']=document.getelementbyid('keyword_table_<?php echo ceil($countcallscounter/7); ?>').clonenode(true); $('#keyword_table_<?php echo ceil($countcallscounter/7); ?>').datatable( { //"sdom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", "sdom":"<<'span6'l><'span6'f>r>t<<'span6'i><'span6'p>>", "spaginationtype": "bootstrap", "olanguage": { "slengthmenu": "_menu_ records per page" } } );

i know need add together http://datatables.net/api#fnsort not overly familiar js after quick help if possible.

thanks

all have set variable = $(selector).datatable() call. can phone call variable.fnsort().

var otable; // create sure within scope of function, or want execute sort. dataclones['keyword_table_<?php echo ceil($countcallscounter/7); ?>']=document.getelementbyid('keyword_table_<?php echo ceil($countcallscounter/7); ?>').clonenode(true); otable = $('#keyword_table_<?php echo ceil($countcallscounter/7); ?>').datatable( { //"sdom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>", "sdom":"<<'span6'l><'span6'f>r>t<<'span6'i><'span6'p>>", "spaginationtype": "bootstrap", "olanguage": { "slengthmenu": "_menu_ records per page" } } ); function onsort(){ otable.fnsort([0,'asc']); }

also if know column want sort on initialize of datatable could:

$('#example').datatable( { "aasorting": [[ 4, "desc" ]] } );

http://datatables.net/api#fnsort http://datatables.net/release-datatables/examples/basic_init/table_sorting.html

javascript datatables

No comments:

Post a Comment