how i save columns reordering state in data base? please explain allan.
how i save columns reordering state in data base? please explain allan.
jatin gajera
Posts: 60Questions: 23Answers: 0
how i save columns reordering state in database?
how i sent column order in database???
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Check the
stateSaveCallback
.It would be great if this was added to the RowReordering section with some examples etc. Took me hours to figure this out since there are no docs anywhere saying this.
@jvretamero How do you get the data for each column? It doesn't seem to be in the
data
field.RowReordering doesn't use the state saving in DataTables - which is why you won't find that information in the documentation. If you want to make the changes from RowReorder permanent, you need to save the changes to your data source, like in this Editor example.
Allan
@allan I tried something like that example and it doesn't work properly at all. Are there any examples on actually saving after reordering the row? The docs are all over the place.
In the example the Order column is used to keep track of the order. Do you have a column similar?
Take a look at the example by going to the "Ajax load" tab. This may be in a different order but you should see something like this for the first two records:
Go to the "Ajax data" tab then reorder the first two rows. The result will look something like this:
Data Sent:
Server response:
The
readingOrder
field is updated with the order of the rows. You will need some sort of index like this to update in your table.Kevin