Search code examples
javascriptdatatableyuiyui3yui2

DataTables in YUI3 refreshing on every update/change of data


I has been playing with YUI3 3.5pre5 DataTables and realized a big difference in implementations (from YUI2).

When using addRow(), modifyRow() and set(), all the table is reloaded/redrawn/refreshed instead of only the elements affected.

For example when a row is added all the table is redrawn instead of only the new row (like in YUI2).

This is a real problem if you have a lot of data and everything is redrawn because of some cell updated. Or if you need to update the data every x seconds the table will be constantly refreshing making it harder to work with.

I hope I'm doing it wrong and there is way of doing it or a workaround.

Please let me know if there is a way to make the new DataTables behave correctly.

Thanks!


Solution

  • You're not doing it wrong; that's the current state of the code. I'll be optimizing data mutation -> UI in 3.6.0, and like I did during 3.5.0, I'll be maintaining a preview module in gallery that has the latest updates and features.

    There were plenty of performance improvements that I wanted to get into 3.5.0 that I just couldn't fit in due to the architecture and feature migration from 3.4.1.

    In the mean time, here's a patch that should help: https://gist.github.com/2295032

    Note, it's not compatible with nodeFormatters, and may have other edge cases.