Open MintPaw opened 8 years ago
Hi,
The problem is each time you add to the data source the whole list invalidates which is an expensive operation. One way around this is:
list.dataSource.removeAll();
list.dataSource.allowEvents = false;
for (i in item) {
list.dataSource.add(i);
}
list.dataSource.allowEvents = true;
That should stop all the invalidations and speed things up considerably. The data source emitting events isnt the best design and i dont think it will come over to V2, at least not in the way it works currently.
As for you docs, im afraid the docs are pretty poor... Simply put i dont have time to rectify it either :(
That's actually the first thing I tried, setting them to false works, but setting them back true throws an error
Class cast error
Called from haxe.ui.toolkit.containers.ListView::syncUI line 252
Called from haxe.ui.toolkit.containers.ListView::_onDataSourceChanged line 224
Called from openfl._legacy.events.EventDispatcher::dispatchEvent line 98
Called from haxe.ui.toolkit.data.DataSource::dispatchChanged line 202
Called from haxe.ui.toolkit.data.DataSource::set_allowEvents line 46
Called from mintDebugger.MintDebugger::setScope line 95 // allowEvents = true
This is using the latest git version.
Thats very strange. If you have time and can create a minimal sample, especially one that shows that error, then it will be easier to help work out whats going one. Ive used that .allowEvents
with no problems.
I was able to fix it using:
var newDS:ArrayDataSource = new ArrayDataSource();
for (c in _topEntry.children) newDS.add(c.dsEntry);
_list.dataSource = newDS;
This works for now I guess, I'm guessing I've broken it since I've just been hacking stuff together.
This is more of a question than an issue as I'm likely simply doing something wrong. I'm trying to make a list of periodically updating text values in a ListView, a list in which I sometime need to completely change to new data. I'm doing this as:
Where c.dsEntry is an object containing only a .text property be updated.
Also, individual objects don't update automatically, after updating each tick my "data source objects" I must also dispatch:
Although this isn't very relevant.
The removeAll/add stage is incredibly slow often taking 7+ seconds only removing/adding 100 objects total, what am I doing wrong? The call stack showing the lag is here
Is there a better place for me to learn haxeui than here? The lack of documentation makes it almost impossible to learn, unless you're an expert in a similar API I presume. And I'm not seeing any forums or IRC channels.