rows().invalidate() fail on table initialized from DOM

rows().invalidate() fail on table initialized from DOM

nlipsnlips Posts: 3Questions: 0Answers: 0

Replies

  • allanallan Posts: 63,708Questions: 1Answers: 10,502 Site admin

    Hi,

    This has already been fixed in the nightly version and will be included in the 1.10.9 release.

    Allan

  • cigaarcigaar Posts: 4Questions: 1Answers: 0

    Hi,

    Looks like there's still a problem with rows().invalidate(), even with the nightly build. Anyway, I can't understand why this test case doesn't work:

    https://jsfiddle.net/g3dok19h/1/

    In it, you'll see that:

    What am I missing?

    Thanks,
    Patrick

  • allanallan Posts: 63,708Questions: 1Answers: 10,502 Site admin

    The issue is that $.merge is adding the two names "Fred" and "Fiona" as new elements in the array. DataTables doesn't track the original array, just the objects in it.

    If you were to change the data in those objects then it works as expected.

    Allan

  • cigaarcigaar Posts: 4Questions: 1Answers: 0
    edited August 2015

    Thanks Allan, you're the best.

    I needed to change all objects in the array, I ended up using:
    table.rows().remove().rows.add(data).draw();

This discussion has been closed.