pre sort callback

pre sort callback

HalfoneHalfone Posts: 1Questions: 0Answers: 0
edited March 2014 in DataTables 1.9
Hello!

I have a page with a datatable. There is also a process that update directly the DOM of my table. I have no control over this process.

The table is sortable. But I think that the sorting mechanism of datatable is based upon the 'internal' stored data, that is different from the updated DOM.

So i've found the plugin "fnDataUpdate" that seems to solve the problem: it updates the internal stored data of datatable with the actual DOM content.

Now i have to apply the fnDataUpdate method before sort happen... but i can't found any callback to do this.

Searching for similar questions, i've found the 'fnDrawCallback' or 'fnPreDrawCallback' methods, but both doesn't function.

I've tried to bind the callback on the 'sort' event, but this is called after the sort is completed :/

Any suggestion?

Thank you very much :)

Here is a jsFiddle link

http://jsfiddle.net/4qtjJ/

to reproduce the problem:

1. click on the start button and wait the td change value
2. click again on the button to stop the process
3. click on 'Column' to do the sort (wrong)

4. uncomment the METHOD 1 or METHOD 2, run again the fiddle and do the steps 1. 2. 3.

5. observe that with METHOD 1 or METHOD 2 only the very first sort don't function.

this is because the fnDataUpdate is correctly executed... but AFTER the first sort happen, so its effect are visible from the second sort...
This discussion has been closed.