PDA

View Full Version : panel as a leaf in nestedlist



lekraken
28 Jan 2011, 3:35 AM
Hi,

I try to set a panel as a leaf in a nestedList and I not understand what's wrong with my code. Someone know why ?
Thanks a lot,



// store with data
var data = {
text: 'Categorie',
items: [{
text: 'Gamme Route',
items: [{
text: 'Blousons/Vestes',
items: [{
text: 'Blouson cuir steeve noir',
items: [{
xtype:'panel',
layout:'card',
style:'background-color:black;',
html:'<div id="calendar">test</div>'
}]
}]
},{
text: 'Pantalons',
leaf: true
},{
text: 'Gants',
leaf: true
},{
text: 'Bottes',
leaf: true
},{
text: 'Casques',
leaf: true
},{
text: 'Equipement pluie',
leaf: true
},{
text: 'Sportwear',
leaf: true
},{
text: 'Divers',
leaf: true
}]
},{
text: 'Gamme Tout Terrain',
items: [{
text: 'Pantalons',
leaf: true
},{
text: 'Maillots',
leaf: true
},{
text: 'Bottes',
leaf: true
},{
text: 'Casques',
leaf: true
},{
text: 'Divers',
leaf: true
}]
},{
text: 'Accessoires Motos',
items: [{
text: 'Bulle/Pare-brise',
leaf: true
},{
text: 'Chromes',
leaf: true
},{
text: 'Carénages',
leaf: true
},{
text: 'Divers',
leaf: true
},{
text: 'Sac/Sacoches',
leaf: true
}]
}]
};

Ext.regModel('ListItem', {
fields: [{name: 'text', type: 'string'}]
});

var store = new Ext.data.TreeStore({
model: 'ListItem',
root: data,
proxy: {
type: 'ajax',
reader: {
type: 'tree',
root: 'items'
}
}
});

Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function() {

var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'Categorie',
displayField: 'text',
backText: '<',
store: store
});
}
});

AndreaCammarata
28 Jan 2011, 5:27 AM
Hi lekraken.
I think you are making confusion :).
You are trying to define a Sencha Component inside the data you have to load inside your store.
You are not allowed to do this.

Hope this helps.

lekraken
28 Jan 2011, 7:14 AM
yep, effectively I do a wrong declaration. It's not a surprise if I say that I'm a newbie in Ext. I scratch a little bit more and I found the good solution with re-definition of method "getDetailCard" and event handler "nestedList.on('leafitemtap',...)"
Thanks a lot

AndreaCammarata
29 Jan 2011, 2:01 AM
You are welcome.