Is it poss to initialize DataTables with data onload & keep pagination & other server side features
Is it poss to initialize DataTables with data onload & keep pagination & other server side features
I have assumed support of an internal web app written with asp.net mvc 4, which is utilizing DataTables. I know that I can either set DataTables to use either client side or server side for the data. Everything was using the ajaxSource property to query for the table data on page load. This is quite slow as its essentially two renders that have to happen, so I opted to replace the ajaxSource property for the data property within datatables. I am JSON encoding the data beforehand in the MVC view. This worked fine for the simpler tables. However, I have a datatable on a page which allows the user to pick from a dropdown of years, to fetch older data using the fnReloadAjax plugin to call the datatables endpoint with the appropriate year to pull back the correct data.
Upon cursory examination, this works fine except the older datasets have quite a bit more data in them and I am running into issues where pagination will be helpful.
By moving from ajaxSource to data, i lose the ability to handle pagination server side to limit the older datasets. I'd like to know if its possible to preload the 'data' property and still utilize server side processing for the pagination and search functionality, and if it is are there any examples?
Answers
You can use this code as an example and hope this is what you are looking for. In this way you can have your filter feature plus pagination and search features while using the ajax source.