DataTable Pipeline Showing One Less Record out of Total Records & Column Sort Doesn't work

DataTable Pipeline Showing One Less Record out of Total Records & Column Sort Doesn't work

good_frengood_fren Posts: 9Questions: 4Answers: 0
edited January 2018 in Free community support

I'm having problem when I try to redraw the page when using the Serverside feature using the Pipeline.
Here are the Scenarios:
1: When I redraw the page using pagination [by using: datatable.page(50).draw()], it is working fine.
2: When I redraw the page using [dtable.page(-1).draw()] to view all records, it is giving two problems:
a: It display One less record out of total records. eg: 99 out of 100 records
b: the column sorting **in the full page won't record as it is sending the request as:<startRow>1</startRow><endRow>-10</endRow>**

Answers

  • rduncecbrduncecb Posts: 125Questions: 2Answers: 28

    Use datatable.page.len(-1).page(0).draw();

    Refer to the docs for page.len and page.

  • good_frengood_fren Posts: 9Questions: 4Answers: 0
    edited January 2018

    It doesn't do anything. It's still showing 99 out of 100 records and Column sorting is breaking as well. Also, I guess you have not read the Problem Description properly. I have already mentioned that i'm already using dtable.page(-1).draw();

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    edited January 2018

    dtable.page(-1).draw()

    Won't display all the rows. datatable.page.len(-1).page(0).draw(); as @rduncecb mentioned will.

    It appears the pipeline plugin code is not written to handle page length of -1. The code that checks to see if it needs to perform an ajax request determines it does not, so no ajax request. And the code executed when it does not perform an ajax request does not take into consideration a page length of -1 so it is not calculated correctly and it shows one less record than what is in the pipeline. I can see that column sorting, etc would not work correctly either

    The pipeline plugin would need to be updated to provide support for page length -1. Since you are provided the code you are free to update as needed to fit your requirements.

    Kevin

  • good_frengood_fren Posts: 9Questions: 4Answers: 0
    edited January 2018

    I'm using the Datatable for the Serverside and I have two different scenarios I'm working on. These two Scenarios can be switched

    1: Page Layout: When I am viewing on page basis, I can switch to the View All Records basis. The Page Layout is working fine as required.

    2: View All Records: When I am viewing all records, I can switch to Paginate option to view records on page basis. When I switch from the page layout basis to view all records, this is when I'm getting the problem, cause I'm using the pagelength -1 to view all the records.

    So, what is the best way to work on this scenario? Are there any other ways that I can work on the pipeline and to view on All the records basis or on page layout basis?

This discussion has been closed.