table not clearing when you reload data
table not clearing when you reload data
Here is my example http://live.datatables.net/gomamudu/1/edit
If you click on a couple of rows. You'll see a div appear. If you click one of the rows. The div still appears until the last row is deselected.
The problem is if you then click on the Load new data button, click on a couple of rows and then click on one to deselect. The div is hidden even though there are rows still selected.
I added console.log to those select and deselect functions. I noticed they fire once before you click on the load new data button. But if you click on that button. Those functions fire 2 times. If you click it again. Those will fire 3 times. I
Any idea's?
Thanks
This question has an accepted answers - jump to answer
Answers
You need to turn of the
select
anddeselect
events before creating them again. So each time yourLoadNewData()
function runs you are appending to the events. Here is an example of usingoff()
to turn them off.http://live.datatables.net/gomamudu/2/edit
Kevin