Client sorting and paging not binding correctly
Client sorting and paging not binding correctly
Datatables 1.10.5, MVC 5
I don't know how to post a sample or link as it is the server side that is not getting all the data posted correctly.
If I leave default sorting for DT and post page 1, I get all 25 rows returned to the controller. If I change to page 2 and post, I don't get any rows posted to controller. If I change the sort in my code and post from page 1, I don't always get 25 rows posted. When I do a "view page source", all the model binder names and ids look correct for the mvc model binder.
Is there a setting or something I am missing?
Answers
Try setting up a failing test case here http://live.datatables.net/ or use this one as a starting point http://jsfiddle.net/0rqxafhL/4/
I think you're going to have to give more information if you want help
I'm trying to set something up but I'm not sure how to replicate what gets posted to the controller for my mvc app
I have a table with all client side processing. Column 1 has a checkbox, all other columns are text (no inputs). The table has multiple pages and I have paging set at 25 rows and it wrapped in a form tag. I'm doing nothing to the table or sorting, etc - just using default ('#table').datatable(). When submitting the form on page 1, my controller is receiving the 25 rows from page 1 as expected. When changing to page 2 and submitting, my controller is not receiving any rows. If I change sort orders as all, I am also not receiving any rows in my controller.
In 1 other test I just ran: showing only 25 rows on page 1 and having multiple pages available, a submit only returns 25 rows. When changing row limit to "all" and submitting, I get 1700 rows returned. If I change to page 2 and submit, I get none. Should DT be returning all rows regardless of page size?
I think I have a test case - not failing yet - at least setup.
http://live.datatables.net/xewahuxa/1/edit?html,js,output
After further digging and testing in Chrome and looking at post data, it appears as though the submit is only submitting the first page and not the entire table. If I switch to "all", the form does post back all records.
Making progress. I added the following:
This is now posting ALL rows of the table regardless of what page or page size you have selected.
But, if I search, the reduced set of records are NOT posted. It posts no records.