Pagination not working in salesforce lightning component.

Pagination not working in salesforce lightning component.

soniHemnatsoniHemnat Posts: 1Questions: 1Answers: 0

Hi,
I am using data tables in Salesforce lightning component. In the component i am try to do pagination and getting few of issue so i need help.
1. On page load it is showing 10 records, so when i change record count to 25 it is showing 25 records which is right but when i move record count to 10 then it is showing 25 record.
2. After page load when i click on next button it is not hide previous records and showing next 10 record.

THIS IS THE CODE

var table = $('#msgPreview')
.on( 'page.dt', function () {
console.log('================= before pagination');
})
.on( 'order.dt', function () {
console.log('================= before sorting');
})
.DataTable({
"order": [
[1, 'asc']
],
"initComplete": function(settings, json) {
console.log('================= initComplete');
var sortNameIcon = component.find("sortNameIcon");
sortNameIcon.set("v.iconName", 'utility:arrowup');
//var prePagination = component.get("c.preHandlePagination");
//$A.enqueueAction(prePagination);
var spinner = component.find('spinner');
$A.util.addClass(spinner, 'slds-hide');
},
"fnDrawCallback": function(settings, json) {
console.log('================= fnDrawCallback');
//var action = component.get('c.preHandlePagination');
//$A.enqueueAction(action);
},
paging: true,
searching: false,
ordering: true,
info: false,
retrieve: false,

        rowReorder: {
            selector: 'tr',
        },
        columnDefs: [{
            targets: 0,
            visible: true
        }]
    });

Or is there any method which is calling after sorting method then that is also very helpful.

Please Help! i got stuck on this issue form very long time.

Answers

This discussion has been closed.