PDA

View Full Version : List taking a long time to show data



kgilb
25 Oct 2010, 10:37 AM
Ext.regModel("Symbols", {
fields: [
{ name: "Sym" }
]
});


store = new Ext.data.Store({
model: "Symbols",
filterOnLoad: false,
proxy: new Ext.data.AjaxProxy({
url: 'Massive.ashx?service=WL&BFCID=13',
reader: {
type: "json",
root: ""
}
})
});

var symList = new Ext.List({
title: 'Symbols',
itemSelector: 'div.wlsymbol',
singleSelect: true,
scroll: 'vertical',
tpl: [
'<tpl for="."><div class="wlsymbol">{Sym}</div></tpl>',
],

flex: 1,
dock: 'left',
clearSelectionOnDeactivate: false,
store: store
});

store.load();


I'm using the code code above to fill a list with JSON data from the server. The server response is about 300 ms but it takes up to 5+ seconds for the list to show anything. It doesn't seem to matter if the list has 5 items or 100 item, it takes far too long to display the data. If I don't use a data store and I load the data using symList.update() the data is displayed instantly. I'm testing the code in Safari. Is there something i'm doing wrong? Do I need to call a refresh method on the list?

VinylFox
25 Oct 2010, 11:24 AM
Not having that problem, im loading lists with way more data and a more complex template and seeing the results within seconds.

Something that stood out in your code was the tpl definition as an array, whats the reason for that?

Also, if your just going to call store.load after your List creation, then you might as well configure your store with autoLoad: true.

kgilb
25 Oct 2010, 1:09 PM
I sort of solved my problem by changing how my layout is configured. I put the above code in a basic Ext.Panel and it comes up very quickly. I must have had a problem in my layout somehow.