add function to own pagination through callback

add function to own pagination through callback

denisvaneckadenisvanecka Posts: 8Questions: 3Answers: 0
edited February 2017 in Free community support

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

  • denisvaneckadenisvanecka Posts: 8Questions: 3Answers: 0

    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;
    }
    }

  • denisvaneckadenisvanecka Posts: 8Questions: 3Answers: 0
    edited February 2017

    instead of variable use oSettings.variable , it was very easy ...

This discussion has been closed.