sort after changing a cell's content
sort after changing a cell's content
Jo-Ker
Posts: 4Questions: 0Answers: 0
I have a simple table like this:
ID | NAME | SURNAME
1 | Alfred | Hitchcock
2 | Burt | Reynolds
3 | Cassius | Clay
4 | Dan | Aykroyd
5 | Peter | Parker
If I change the NAME (using javascript function) of row #2 from "Burt" to "Ryan", when I try to order the table by NAME, the table dont change the order.
This discussion has been closed.
Replies
Since you aren't using Datatables API's to change the data I think you will need to use
rows().invalidate()
to have Datatables re-read the table information. You might get better performance to userow().data()
orcell().data()
to update the data through Datatables and remove the need to invalidate the data.Kevin
Ok, so how should I correct the function "changeName"?
As Kevin says, you have two options - use
cell().invalidate()
orcell().data()
. The former is used to tell DataTables that you have updated the cell externally, the latter will tell DataTables to change it.See the API manual page if you aren't sure how to use the API.
Allan
Ok this is the cottection:
Thanks