PDA

View Full Version : ListView bindStore misunderstanding



ragnaev
26 Apr 2010, 11:08 PM
Hi

Have some problem with using bindStore method for ListView. Please help :)
May be another solution for this task?

In any case thanks for the help :)

I have:
1. A Window with TabPanel inside and 7 tabs.
2. In each tab i have one element is ListView.
3. With AjahRequest i get json with content for 7 ListView and want dynamicly update all ListView from a json.

My problem:
I get correct json from php code, all visual elements created, but when i use bindStore in the cycle it fills only
two first tabs and all other tabs are empty.


The code:



Ext.AjaxRequest({
loadMask: true,
url: 'getJson.php',

success: function(resp){
var store = Ext.decode(resp.responseText).myJson
for (i = 0; i <= 6; i++){
var s = new Ext.data.JsonStore({
data: store[i],
fields: ['start', 'title']
});
tabs.get(i).items.get(0).bindStore(s); // ListView element in tab at (0) position
}
}
})

var tabs = new Ext.TabPanel({
activeTab: 0,
plain: true,
autoScroll: true,
items: []
});

for (i = 0; i <=6; i++){

tabs.add({
title: i,
items: [{
xtype: 'listview',
store: [],
columns: [{
dataIndex: 'start'
},{
dataIndex: 'title'
}]
}]
})

}

var w = new Ext.Window({
width: 640,
height: 480,
items: tabs
});
w.show();

evant
26 Apr 2010, 11:13 PM
This code looks quite suspect, I doubt it even works.



tabs.get[i].items.get(0).bindStore(s); // ListView element in tab at (0) position




tabs.items.itemAt(i).items.itemAt(0).bindStore();

ragnaev
26 Apr 2010, 11:50 PM
Thank you evant for replying

but still no luck

my code really work but i guess it really ugly :)

error in my example sorry:


tabs. get[i] .items.get(0).bindStore(s)
change to
tabs. get(i) .items.get(0).bindStore(s)




tabs.items.itemAt(i).items.itemAt(0).bindStore();


evant, when i click on tab firebug says



item is undefined
[Break on this error] item.on(ename, fn, scope, opt);

ragnaev
27 Apr 2010, 10:05 AM
Unfortunately the problem has not resolve.

I change


tabs.get(i).items.get(0).bindStore(s);

to


tabs.items.itemAt(i).items.itemAt(0).bindStore(s);


and got the same result as before.

Is this a bug in my script or in extjs?

firebug says:


el is undefined
[Break on this error] el.update("");

ext-all-debug.js (?????? 41570


Please help :((