1

Is there a way to replace a qx.data.Array? I see methods for a whole lot of other options in the API but not that. I know I can do a removeAll() and then append new items, but that fires some events in my controller that I wish wouldn't fire. Thanks!

Jonathan
  • 894
  • 2
  • 9
  • 20

1 Answers1

2

Check out the splice method which will work out fine. You can delete the whole content of the array and append new items in one call.

Martin Wittemann
  • 2,109
  • 1
  • 12
  • 14
  • Thanks @Martin, I looked at that and was "scared off" by the fact that is says for every new item added or removed an event is fired and I was trying to steer clear of multiple events firing. I'm using a SelectBox with a controller that updates the ListItems in that list when the array is changed. I have a changeSelection listener on the SelectBox and it gets fired a lot... so I handled it with a if(e.getData().length>0){ call, but that's not perfect by any means. – Jonathan Mar 28 '12 at 10:54
  • 1
    We already changed that. Only one event is fired for splice now. :) Will be sure in the 2.0 release. – Martin Wittemann Jun 05 '12 at 14:38