PDA

View Full Version : Data store reload data issue in .93



meyerovb
9 Aug 2010, 8:35 AM
I believe the following code functioned without throwing an error in .91, but is broken in .93

Are we only allowed to pass in instances of a model? If this is supposed to work please move it to the bugs forum, thanks.



Ext.setup({ onReady: function () {
new Ext.List({
fullscreen: true,
store: new Ext.data.Store({ fields: ['label'] }),
tpl: new Ext.XTemplate('<tpl for="."><div class="list-item">{label}</div></tpl>'),
listeners: {
afterrender: function (list) {
try { list.getStore().loadData([{ label: 'a', label: 'b'}]); }
catch (e) { alert(e); }
}
}
});
}});

evant
9 Aug 2010, 5:25 PM
You're missing the itemSelector:



Ext.setup({
onReady: function(){
new Ext.List({
fullscreen: true,
store: new Ext.data.Store({
fields: ['label']
}),
itemSelector: '.list-item',
tpl: new Ext.XTemplate('<tpl for="."><div class="list-item">{label}</div></tpl>'),
listeners: {
afterrender: function(list){
list.getStore().loadData([{
label: 'a'
}, {
label: 'b'
}]);
}
}
});
}
});

meyerovb
9 Aug 2010, 6:30 PM
I figured that out but this post had been moderated. I think .91 was working without specifying the item-selector (shouldn't the item-selector be .list-item for lists by default?) I specified the itemselector and it worked fine.

evant
9 Aug 2010, 7:01 PM
I don't like the idea of having a default item selector. The template for a list can be whatever you want, so forcing that as a default will likely make people think they ~have~ to use list-item.

meyerovb
9 Aug 2010, 7:14 PM
Why not make it the default value for the config option, and it gets overridden if specified in instantiation? It's better than throwing an error if it's missing and the coder not knowing why since he followed the same template that the list renders natively