Rows are selected differently on document load and on function call.

Rows are selected differently on document load and on function call.

ArtuvazroArtuvazro Posts: 11Questions: 5Answers: 0
edited January 2015 in Free community support

Hello again!

I was working on my own filter for datatables. To make a long story short, it gets a date value placed in one of the columns and checks it against the current date, and if its value is inferior to our current date then the entire row is deleted. I managed to make this work perfectly. However, this only works properly on document load. I've tried to attach my code to a button and then it behaves differently: instead of selecting rows according to its place in the original data source (in this case the table is written in html inside a php file), it selects rows according to its place in the current view.

Here is a working jsfiddle: http://jsfiddle.net/c18mzcox/

In order to check what I'm saying just click the "hide finished" button and check which rows are being deleted (index 0 and 6 from the view, which is wrong). Then, edit the javascript part and delete the button in line 22 and its corresponding ending in line 75. Refresh and see how this time the rows being deleted are different (index 0 and 6 from the original file, which is right). Without any button attached it works as it should. But attaching a button to the code changes the behaviour of row selection...

What am I missing here?
Thank you very much!

Answers

  • ArtuvazroArtuvazro Posts: 11Questions: 5Answers: 0
    edited January 2015

    I managed to get a workaround fix to this by destroying the table and creating it again before applying my date filter each time you press the button to hide rows.

This discussion has been closed.