PDA

View Full Version : The mysterious little black box of doom



lieuweprins
29 Oct 2013, 7:13 AM
I'm making an app. I'm not really doing anything very strange. I have a list, and I have a store tied to that list. upon the show event of a container, I start filling that store with something like five items.

This is (sorta) what is in the show event.


/* ContentStore is a treestore. I'm filling the list's store,
MainListStore, with the items at the root of the treestore. */

var store=Ext.getStore('MainListStore');
var root = Ext.getStore('ContentStore').getRoot();
Ext.getStore('ContentStore').removeAll();


root.eachChild(function(node){
store.add({
title: node.get('title')
});
});
console.warn("DONE");


Now, the odd thing is, when "DONE" appears in the console, the list is still empty. it shows a little black square while it appears to be loading... something, for about 1-2 seconds. I don't know what it is supposed to be loading, since the store isn't tied to anything, it's a plain Ext.data.Store that's filled by using store.add. And the list has that store set as it's store. the list's itemTpl displays the title field in the store.

While it is loading (already past all of the store.add calls) it looks like this: https://www.dropbox.com/s/p2v9jrfi11fhmx9/during.PNG
Afterwards, when done loading, it looks like this: https://www.dropbox.com/s/2ngckwzj3zattcc/after.PNG

1) What is it loading? Why does it need two seconds to draw a plain list of five items when the rest of the screen seems to be already drawn?

2) This is the most important question. I'm asked to do something about the little black square. But I have no idea where it is coming from. It only seems to happen with this list. I've tried messing with the list's properties but it doesn't seem to go away. So, where's that little square coming from?

The only reference I've been able to find is this thread: http://www.sencha.com/forum/showthread.php?123143-Loading-data-into-list
which mentions a list not loading and a little black square showing instead. In my case, my list loads, but yeah, still... Little black square.

Halp.

fmoseley
31 Oct 2013, 8:06 PM
Try moving it from the show event to the containers initialize method. Then this processing can take place before the component is shown.