execute JS after sorting
execute JS after sorting
Hi All,
I have bumped with problem,
my table cells have java script code. When page loading, JS executes but after sorting, when it loads new data, no actions from JS though I see it via FireBug ( no errors ). How to make it execute JS after data reloading?
Thanks
I have bumped with problem,
my table cells have java script code. When page loading, JS executes but after sorting, when it loads new data, no actions from JS though I see it via FireBug ( no errors ). How to make it execute JS after data reloading?
Thanks
This discussion has been closed.
Replies
How is the table loading new data?
Allan
(Sorry, I didnt write this code, just fixing exxisting code and I am not familiar with dataTable, if you can, please explain me 'on fingers' where to put and how to use. Thank you! )
[code] $js = '
oTable = $(".store_datatable").dataTable({
"sPaginationType": "full_numbers",
"bLengthChange": false,
"aaSorting": '.$this->EE->javascript->generate_json(array($default_sort), TRUE).',
"bFilter": false,
"bAutoWidth": false,
"iDisplayLength": '.$perpage.',
"aoColumnDefs" : '.$this->EE->javascript->generate_json($col_defs, TRUE).',
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "'.html_entity_decode(BASE.AMP.STORE_CP.AMP.'method='.$ajax_method).'",
"fnServerData": function (sSource, aoData, fnCallback) {
var extraData = $("#filterform").serializeArray();
for (var i = 0; i < extraData.length; i++) {
if (extraData[i].name == "perpage") {
$(".store_datatable").dataTable().fnSettings()._iDisplayLength = parseInt(extraData[i].value);
}
aoData.push(extraData[i]);
}
$.getJSON(sSource, aoData, fnCallback);
},
"oLanguage": {
"sZeroRecords": "'.$this->EE->lang->line('no_entries_matching_that_criteria').'",
"sInfo": "'.lang('dataTables_info').'",
"sInfoEmpty": "'.lang('dataTables_info_empty').'",
"sInfoFiltered": "'.lang('dataTables_info_filtered').'",
"sProcessing": "'.lang('dataTables_processing').'",
"oPaginate": {
"sFirst": "",
"sPrevious": "",
"sNext": "",
"sLast": ""
}
},
"fnRowCallback": function(nRow,aData,iDisplayIndex) {
$(nRow).addClass("collapse");
return nRow;
}
});
oSettings = oTable.fnSettings();
oSettings.oClasses.sSortAsc = "headerSortUp";
oSettings.oClasses.sSortDesc = "headerSortDown";
'; [/code]
Allan