Loading a large list model with a WorkerScript
-
I am trying to use a WorkerScript to load up a list model with a very large data set. Something like:
@
WorkerScript.onMessage = function(msg)
{
if (msg.action == 'append')
{
var model = msg.model;
for (var i = 0 ; i < msg.data.length ; i++)
{
var o = {...};
model.append(o)
model.sync();
}
}
}
@As far as I can tell I need to sync() after every append() or else the ListView doesn't display correct. I will see some of the rows repeated at the end although the count is right and the extra items can't be selected.
But the sync() call makes longing considerable slower -- from seconds to minutes. Is there a better way of doing this?