PDA

View Full Version : NestedList: dinamic change store



Nertus
1 Feb 2011, 3:28 PM
Hi, there!
I want to change store on next levels(from "storage1" to "storage2") in exist NestedList by 'itemtap' event.

My NestedList & store:


storage1 = new Ext.data.TreeStore({
model: 'Sections',
proxy: {
type: 'ajax',
url: App.sectionsStorage,
reader: {
type: 'tree',
root: 'items'
}
}
});
storage2 = new Ext.data.TreeStore({
model: 'Exercises',
proxy: {
type: 'ajax',
url: App.exercisesStorage,
reader: {
type: 'tree',
root: 'items'
}
}
});

sections = new Ext.NestedList({
title: App.name,
fullscreen: true,
updateTitleText: false,
useTitleAsBackText: false,
onItemDisclosure: true,
displayField: 'name',
setLoading: true,
getItemTextTpl: function() {
return '<div class="section-item"><tpl if="thumb"><img src="images/{thumb}" width="80" height="80" class="thubms"/></tpl><div class="section-info"><h2>{name}</h2><tpl if="description"><p class="section-description">{description}</p></tpl></div></div>';
},
store: storage1,
toolbar: Layout.header
});
And 'itemtap' event:


sections.on('itemtap', function(subList, index, el, e, detailCard) {
var level = this.getRefItems().length; //get tree level

}
Thanks!

Nertus
3 Feb 2011, 2:32 PM
up