Run function after editing effect
Run function after editing effect
After an edit is made on a row, it has an effect where it turns yellow and fades back to white. I would like to run a function, but only after the effect takes place. If I try editor.on('submitComplete', myfunction()) it actually runs before the data in the table is even updated. Is there a way to run myfunction() after the visual effect is complete and the table is updated? I would like to do this, as it will make it more intuitive to the user that the data has been updated, before the table is changed by myfunction().
This question has an accepted answers - jump to answer
Answers
I have also tried 'postEdit' in place of 'submitComplete' and got the same result.
Hi,
Currently I'm afraid no, there is no event that is triggered after the animation has taken place. What you could do though it use a
setTimeout
:The animation lasts for 1050mS, hence the 1050 in the code above.
Allan
Hi @ggerbush ,
If you want it after the
submitComplete
andpostEdit
, you'll need to add a listener to thedraw
. This, though, is called on every table draw (filter, page, ordering, etc), but you could set a flag in theedit
so that you know the edit was the cause of the trigger,Cheers,
Colin
@allan Thank you! That worked perfectly!
@colin Thanks for the response. I looked into using the draw event and I'm not sure if the table is redrawn after the animation, but in myfunction() it may redraw the table anyway depending on the change in data and I didn't want to cause a bunch of loops.
The animation happens after the table is redrawn - so yes, you'd still need to use the
setTimeout
method. Colin and I overlapped in our replies .Allan