Do we have callbacks that trigger on "invalidate"?
Do we have callbacks that trigger on "invalidate"?

Description of problem:
Hey folks!
I hope i am not doubling a previous question. I tried to find topics that answer my question and some were dealing with related issues but didn't really hit home in the end.
The question in itself is relatively simple as stated by the topic of this post.
To illustrate my problem:
I have a datatable with rows that feature a set of different interaction-options within one column depending on the data, like users being able to take tasks or give up on them or removing items from the list and so on. That means that i need to update rows dynamically. I currently do this within rowCallback
. I found to be sure that those are being called i need to use ...draw()
after updating the row-data. But a redraw of the entire table creates issues when a user is rather fast with their clicks and for example wants to self-assign multiple tasks by clicking the corresponding buttons. the response for the first request comes in, the table is being redrawn and the elements for which the remaining requests were still running don't exist anymore and the rows stay unchanged even though the server answered the request properly. so basically the table redraw has hidden the effect of still running requests. When i use invalidate
, the table seems to stay generally "intact" but the rowCallback
is not being called so the vizualization of the row stays incomplete.
Hence the question for a callback that we can call on invalidate to update (for example) row visuals.
Or am I simply missing the intended approach for such a scenario?
This question has an accepted answers - jump to answer
Answers
Are you using server-side processing here?
If you modify the data, you more or less need to call
draw()
to have the table reflect the current state - e.g. the change in data might have effected the ordering or the search result for the table.There currently isn't a callback for the invalidation, but that is something that I hope to introduce. The way the events work at the moment isn't hugely efficient for that sort of thing, and I plan to address that in DT3. Hopefully!
Allan
Hey allan!
Thank you for the fast reply. Yes, I do modify the data of single rows server-side and need to update accordingly. Previously I did this by manipulating the DOM directly so the problem I described was not that visible but objectively speaking that approach was quite error-prone due to having to process edge cases over multiple controllers in the front-end. The data-driven "row itself knows how it should look like based on given data"-approach is way cleaner in my eyes. So if DT3 can feature that, that would be great and certainly would increase the value of the plugin (even further; you guys saved me a great deal of time already, so kudos for that!
).
But well...your reply is already useful for me as it informs my decision how to proceed for the time being!
Thanks again!