Keeping selected rows after executing ajax.reload()
Keeping selected rows after executing ajax.reload()
I have an AJAX sourced table that also has select
enabled. When someone selects a row, then does something that triggers ajax.reload()
, it will de-select the row.
I tried to use ajax.reload( null, false )
, but that didn't seem to work.
Im really trying to avoid doing something like... keeping an array of selected rows (which gets updated everytime something is selected/deselected), then on ajax.reload()
, re-select those rows. That would cause a "flicker" in the selects as well.
Thank you!
This question has an accepted answers - jump to answer
Answers
This is the current work-around I have for it, which works, its just really... unorthodox
Basically, whenever rows are selected, it adds the row to the
selected_rows
array, and whenever rows are deselected, remove them from the array, then when the table is re-drawn, it selects the rows again.Good news is it seems to work without the "flicker" I was expecting, but I still think that theres gotta be a better way.
Take a look at this example https://datatables.net/extensions/select/examples/initialisation/reload.html
Thanks @cipster, I think I actually ended up using that.. Just forgot to update the thread :)
great!!!!