Is there any way to know when rowGroup rendering is completed?

Is there any way to know when rowGroup rendering is completed?

thangnvthangnv Posts: 12Questions: 2Answers: 0

Hi, I use rowGroup and sum a column in endRender. The problem is if I create/edit a row, sum will be called twice. The first call is incorrect sum, and the second call is the correct one. I have to check for sum value and alert() if it doesn't match a condition. As the result, one will be false alert. So is there a way to know that the rendering of rowGroup is completed and perform the column sum after that?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,346Questions: 26Answers: 4,776
    edited March 2021 Answer ✓

    if I create/edit a row, sum will be called twice

    How are you doing this?

    Please post a link to your page or a test case replicating the issue so we can see what you are doing and help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    I believe the rowGroup rowGroup.endRender function is only called when the table is drawn, ie, the draw() API is called. Maybe you are calling draw() or performing a function that is calling draw() more than once for you create/edit process.

    Kevin

  • thangnvthangnv Posts: 12Questions: 2Answers: 0

    @kthorngren Thank you for pointing it out. Yes, It's exactly what you've said. Because the dt.draw() doesn't refresh data after inserting/editing, I added dt.ajax.reload() and it unfortunately called table refreshing twice. Now I remove dt.draw and it works as expected.

This discussion has been closed.