0

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!

Jonathan
  • 8,676
  • 20
  • 71
  • 101

1 Answers1

0

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.

Luke
  • 2,571
  • 15
  • 10
  • Thanks for your fast answer!! The patch is definitely helping specially when adding rows. Still when updating a single cell all the row is refreshed. Do you think there will be a full YUI2 like implementation for 3.6.0?? – Jonathan Apr 04 '12 at 05:51
  • Isolating to the cell would not capture changes to columns that reference the value from formatters. Why so important to limit update to just the cell? – Luke Apr 04 '12 at 22:44
  • We are developing a stocks financial application where values are updated every second. Inside the table, in each row there are also buttons, select boxes, check-boxes and inputs, where the user can change/update/insert values. If the user is somehow interacting with the data when the row is refreshed/re-drawn he will lose the data in the inputs, 'focus' on select boxes etc, etc. also some events can 'not fire'... That's why I think is very important to isolate data as much as possible. – Jonathan Apr 05 '12 at 09:50
  • Fair enough. Good feedback. I'll keep that in mind when working on the core implementation. In the mean time, I updated the gist with the start of a cell-specific update model. – Luke Apr 06 '12 at 22:40