Client Side Sorting , but table values are picking from Server Side
Client Side Sorting , but table values are picking from Server Side

Is it possible to do client side sorting values, whereas values are picking from server side...??
This discussion has been closed.
Answers
If you enable Server Side Processing, ie
serverSide: true
, then all of the sorting, searching and paging are expected to be performed by the server. However if you are fetching data via Ajax (server side data but notserverSide: true
) then all of the sorting, searching and paging are controlled by the client side Datatables.Does that make sense?
Kevin
$(document).ready(function() {
</script>
Above mentioned script only am using for sorting, where the values are picking from server side by using ajax, but i try to do sorting from client side which is not working
In this case you are using a DOM sourced table since you aren't using
ajax
ordata
to populate the Datatable. The question is what is the state of theHTMLtable
when you initialize Datatables? If the DOM based table is built before Datatables is initialized then sorting should work. Maybe you can initialize Datatables in the Ajaxsuccess
function after you populate the data.If Datatables is initialized first then it, unless you are using Datatables API's to add the data, it won't know about the data added to the table. Maybe you can post more code to show how all this is working.
Kevin
My Partial Table:
Then using this am displaying values in main page:
Ajax:
After Getting this data i need to do sorting from client side by using datatable
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
Its still not clear the order of operations regarding the data being loaded and DataTables being initialized. I would move the Datatables init code into the
success
function after loading the data. Something like this:Kevin
After initializing above mentioned scripts ,I am getting error like Datatables warning table - cannot reinitialise datatable, For more information about this error, Please see https://datatables/tn/3..
That would suggest the table is being initialised many times. You could either tweak your logic to prevent that, or just initialise with the addition option
destroy
,Colin