Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm trying to use DataTable

I already asked several questions about it, but still without answer, so I tried to figure it out and found a second thing.

My pagging seems to work incorrectly.

For example: I have a table with 10 records. 2 records for page = 5 pages. Table shows me that I have 5 pages and 10 total records. In my DataTable ajax I have second thing:

ajax: {
                ...
            data: function (d) {
                ...
                ...

                return {
                    take: d.length,
                    skip: d.start,
                    ordering: sorting.join(", "),
                    grouping: "",
                    draw: d.draw
                };
            }
        },

For some reason - this is called each time I am clicking on another page, which results into... taking 2 records and skipping all from previous pages. In the result, I have correct values on the selected page, but in the whole table I am able to operate only with them (no another records instead of those in selected pages - so as a result I can forget about those things as search and etc).

If I remove

take: d.length,
skip: d.start,

then, despite having 5 pages, each page shows me all 10 records, and I don't know why.

The things which I also use in DataTable (maybe some of those can cause issue, or at least be response for overdrawing entire table on each page change):

dom: 'T<"clear">rtsipl',
stateSave: true,
drawCallback:
initComplete:
processing: true,
serverSide: true,
pageLength: config.Paging.PageSize,
oLanguage: { "sInfo": "_START_ to _END_ of _TOTAL_ items", "sLengthMenu": "_MENU_ Items per page" },
scrollY: $(window).height() - $(window)[0].screenTop - 90,
scrollCollapse: true
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900