add function to own pagination through callback
add function to own pagination through callback
Hello,
Im not sure if this is prossible, but I need add function to my pagination through callback
I think that fnDrawCallback is what will be needed, and my request:
$.extend($.fn.dataTableExt.oPagination, {
'fnClickHandler': function(e) {
//add function through fnDrawCallback
},
'fnInit': {},
'fnUpdate': {}
}
$('#table').DataTable({
'fnDrawCallback': function(oSettings) {
//how??
}
}
I need add this to fnDrawCallback, Set hash after click f.e. index.html?page=12
Url.updateSearchParam('page', oSettings.oInstance.fnPagingInfo().iPage + 1);
It working, but for all pagination and I need set just for some of them
'fnClickHandler': function(e) {
var fnCallbackDraw = e.data.fnCallbackDraw;
var oSettings = e.data.oSettings;
var sPage = e.data.sPage;
oSettings.oApi._fnPageChange(oSettings, sPage);
fnCallbackDraw(oSettings);
Url.updateSearchParam('page', oSettings.oInstance.fnPagingInfo().iPage + 1);
return true;
}
Answers
Or can be something like this
$.extend($.fn.dataTableExt.oPagination, {
'fnClickHandler': function(e) {
if (variable) {
//my code
}
},
'fnInit': {},
'fnUpdate': {}
}
$('#table').DataTable({
'fnDrawCallback': function(oSettings) {
variable = true;
}
}
instead of variable use oSettings.variable , it was very easy ...