PDA

View Full Version : Value of tapped item in nested list



jiindal1988
2 Nov 2011, 11:10 PM
Hello, I want to get the property of the item clicked in Nested List, how can I get those???

Following is the code for generating Nested list:

Ext.Ajax.request({
url: 'server-url-path',
success:function(msg){
data = msg.responseText;
data = '{"children":' + data;
data= data.replace(',"expandable":true','');
data = data + '}';
// function to generate nested list
loadLocation();
},
failure:function(msg){
}
});

function loadLocation()
{


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

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

//Definition of the NestedList
var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'Elements',
displayField: 'text',
store: store,
getItemTextTpl: function(){
return '{text}<br>{description}';
},
});

new Ext.Panel({
fullscreen: true,
layout: {
type: 'vbox',
align: 'stretch'
},
defaults: {
flex: 1
},
dockedItems:[toolbar, nestedList]
});
}

Structure which I am creating is:

->System
-> Child1
-> Child2
->GrandChild1
->Child3

I want to know on which item the user has performed the last click.

Any help is appreciated.

mitchellsimoens
3 Nov 2011, 6:52 AM
Please wrap your code within code tags so that we can read it with the spacing intact.