Custom Filtering w/ Server Side Problem
Custom Filtering w/ Server Side Problem
phummer
Posts: 4Questions: 0Answers: 0
Hey everyone,
First off sorry if this is a repeat but I have been searching high and low for the answer for this one with no luck. Perhaps I am searching the wrong thing.
Anyhow here is my problem...
We are using dataTables with "bServerSide": true and "sAjaxSource" hitting our .net which gets only a certain number of results at a time. The problem occurs with some filters we have created to filter the result set from our database.
If for example I am at - "Showing 0 to 10 of 100 entries"
and page all the way to - "Showing 90 to 100 of 100 entries"
then change our filters, which only brings back 10 results I see a blank table with the "No data available in table" message and "Showing 90 to 10 of 10 entries"
The bizarre thing is if I page all the way back to first page I can get back to "Showing 0 to 10 of 10 entries" but this shouldn't have to be done.
I checked and I am sending back all the appropriate parameters such as sEcho (string), iTotalRecords (int), iTotalDisplayRecords (int) etc.
For some reason I cannot get the table to reset back to the first page when this is the case.
Is there another parameter I can send back from server to reset the datatable to page 1 or am I missing something?
Thanks for looking!
Look forward to seeing your answers,
Patrick
First off sorry if this is a repeat but I have been searching high and low for the answer for this one with no luck. Perhaps I am searching the wrong thing.
Anyhow here is my problem...
We are using dataTables with "bServerSide": true and "sAjaxSource" hitting our .net which gets only a certain number of results at a time. The problem occurs with some filters we have created to filter the result set from our database.
If for example I am at - "Showing 0 to 10 of 100 entries"
and page all the way to - "Showing 90 to 100 of 100 entries"
then change our filters, which only brings back 10 results I see a blank table with the "No data available in table" message and "Showing 90 to 10 of 10 entries"
The bizarre thing is if I page all the way back to first page I can get back to "Showing 0 to 10 of 10 entries" but this shouldn't have to be done.
I checked and I am sending back all the appropriate parameters such as sEcho (string), iTotalRecords (int), iTotalDisplayRecords (int) etc.
For some reason I cannot get the table to reset back to the first page when this is the case.
Is there another parameter I can send back from server to reset the datatable to page 1 or am I missing something?
Thanks for looking!
Look forward to seeing your answers,
Patrick
This discussion has been closed.
Replies
We use custom filters and a "Apply Filters" button, which triggers ".fnDraw()" to trigger the server request, which brings back the new data.
The thing I noticed is that if I use the built in Length Selector it sends a "iDisplayStart = 0" but when I trigger ".fnDraw()" it is sending an iDisplayStart value that is equal to the page I am on when triggering it.
Looking through the documentation and references I cannot see a better option to trigger the server-side request customly while also resetting 'iDisplayStart' like datatables does with the Length change.
Any insight into what my options are would be greatly appreciated.
The long way would be to manipulate the table after the data comes back but I think that may be overly excessive.
Thanks
I send a serialized form of all the filters to the .net side when the apply button is pressed because I have some more complex interactions between filters. The name value pairs are sent with fnServerParams so the values are sent when fnDraw is called.
Any ideas on how to get fnFilter to work with this? I tried fnFilter() and fnFilter('') just to hit the backed with iDisplayStart = 0 but no luck.
So now fnFilter() works without any parameters and all my serialized and aoData is still sent to the server.
Hopefully someone else stumbles upon this if they have the same problem.