Keep selected rows on redraw
Keep selected rows on redraw
Hello,
I have an ASP.NET, MVC 5, .Net 4.5, C#, JavaScript, Jquery Datatables web application developed in Visual Studio 2017 Community.
Does anyone know how to keep the selected rows in a table selected when a table.draw is done?
I tried every combination of using this: table.draw(false); and this: table.draw('page'); and putting all this code in my javascript: https://datatables.net/examples/server_side/select_rows.html
I tried using the code in that link because it is exactly what I want to do. The multi selection works, but it loses the selections on a subsequent draw.
One thing I can't figure out is what the value of DT_RowId should be when I create it on the server side.
Any help that anyone can provide to resolve this issue would be gratefully appreciated.
Thanks,
Tony
Answers
I fixed this by simply adding a DT_RowId: id property for each row to the json returned to datatables.
"id" is the database id of the record(row) being processed.
Also, I used all of the Javascript coding in the link specified in my original post.
Thanks,
Tony