Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81925

displayStart works but results in incorrect page 'selected' button bottom right

$
0
0

I am using displayStart to show records starting from 13 from a table with 32 records.

Table displays the default 10 records per page.

The resultant table displays from record 13!

However... the default paging buttons (bottom right) reads 3. I would expect this to be 2.

As an extra test, I tried table.page.info().page reads correctly '1' (counting from 0, is what I expect). Why is th paging button on 3? Is this a bug?

Is the value denoting the 'selected' page derived from the upper bound of the rows starting from 13 (13+10=23), which might explain the anomaly, in which case it would be a bug.

What do you think?

Sample code below.

$('#example').DataTable({

    dom: "Bfrtip",
    ajax: {

// Working Ajax
},
displayStart: 13, // Display from Row
order: [[ 1, 'asc' ]],
columns: [
{
data: null,
defaultContent: '',
className: 'select-checkbox',
orderable: false
},
// some other columns

    ],
    select: {
        style:    'os',
        selector: 'td:first-child'
    },
    buttons: [
            {
                text: 'info',
                action: function( e, dt, node, config ){

console.log(table.page.info());
console.log('the page we want to return to is: '+table.page.info().page);
}
},
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{ extend: "remove", editor: editor }
]

});


Viewing all articles
Browse latest Browse all 81925

Trending Articles