Ajax reload with filters
Ajax reload with filters
DanielBlais
Posts: 2Questions: 1Answers: 0
in DataTables
I'm using AJAX to reload my grid content. With AJAX, I'm passing parameters to the server, so it can filter out some rows.
But I want the grid to display : Showing 1 to ## of ### entries (filtered from #### total entries).
Is it possible or I have to convert my grid to be serverside?
Regards
Answers
Not sure if you are using the
ajax
option or jQuery ajax but in any case you can use theinfoCallback
to customize the output. If you are usingajax.data
, or equivalent with jQuery ajax, to send filtering parameter to the server then Datatables won't know about additional row information. It only knows about the data at the client (assuming client side processing).One option is to add additional information to the JSON response from the server. You can add the row totals and extract them using the
ajax.json()
API, if usingajax
, inside theinfoCallback
. But if you use the default Datatables search input it might be confusing to the users.Hope this makes sense.
Kevin
I was mixing client side and server side features. I switch to true serverside and this fixed my issue.