Issue with DataTable paging

Issue with DataTable paging

TulyaTulya Posts: 5Questions: 1Answers: 1

I'm using DataTable, grid with 11 records. The page size I set to default as 10. I clicked on Page#2 and deleted 11th record.
The Grid displaying empty and "Showing 11 to 10 of 10 entries"

It supposed to display
1. It has to redirect to first page.
2. Paging message (Left Bottom) has to show as Showing 0 to 10 of 10 entries.

Your quick response will be appreciated. Thanks in advance!!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

  • TulyaTulya Posts: 5Questions: 1Answers: 1
    Answer ✓

    My issue got resolved...

  • TulyaTulya Posts: 5Questions: 1Answers: 1

    I have added a validation in "dataTables.bootstrap.js" to fix my issue and working fine. Please let me know whether I can modify this file.

    i.e.
    /* Bootstrap paging button renderer */
    DataTable.ext.renderer.pageButton.bootstrap = function (settings, host, idx, buttons, page, pages) {
    // Added code
    if (settings._iRecordsTotal != 0 && settings._iRecordsTotal <= settings._iDisplayStart) {
    settings._iDisplayStart = settings._iDisplayStart - settings._iDisplayLength;
    }

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Please let me know whether I can modify this file.

    Sure. Its MIT licensed, so feel free to modify.

    Allan

  • TulyaTulya Posts: 5Questions: 1Answers: 1

    Thanks for your quick response Allan.

  • TulyaTulya Posts: 5Questions: 1Answers: 1

    Hi Allen,

    I added below mentioned code in "dataTables.bootstrap.js" to fix the paging issue and it is working fine.

    if (settings._iRecordsTotal != 0 && settings._iRecordsTotal <= settings._iDisplayStart) {
    settings._iDisplayStart = settings._iDisplayStart - settings._iDisplayLength;
    }

    Paging Issue:- When table has 11 records and page size is 10. I'm in page number to. It will display only 11th record. When I remove that 11th record it is not redirecting to 1st page and displaying "Showing 11 to 10 of 10 entries".

    But the problem is, When I upgrade "dataTables" to latest version I'll lost the customized code. Is there any way to do this from my js file.

    Thanks in advance!!

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you give me a link to a page showing the error, using an unmodified version of DataTables please? If there is a bug in the distribution software I would like to fix it.

    Allan

This discussion has been closed.