PDA

View Full Version : HOW TO GET THE PARENT DATA ON CLICK OF CHILD VALUE IN TREE GRID



davidmanohar
5 May 2014, 2:47 AM
here is my js.

Ext.onReady(function () {
Ext.define('Person', {
extend: 'Ext.data.Model',
fields: [
{ name: 'value', type: 'int',defaultValue :null },
{ name: 'year', type: 'string' },
{ name: 'sla', type: 'string' },
{ name: 'vendor', type: 'string' },
],
});
var store = Ext.create('Ext.data.TreeStore', {
model: 'Person',
root: {
text: 'Root',
expanded: true,
children: [
{
sla: 'Effort',
children: [
{
sla: 'Effort',
vendor:'TCS',
children: [
{
vendor:'TCS',
year:'2013',
value:'99',
leaf: true
},
{
vendor:'TCS',
year:'2014',
value:'100',
leaf: true
}
]
},
{
sla: 'Effort',
vendor:'HCL',
children: [
{
vendor:'HCL',
year:'2013',
value:'99',
leaf: true
},
{
vendor:'HCL',
year:'2014',
value:'100',
leaf: true
}
]
}
]

},
{
sla: 'Variance',
children: [
{
sla: 'Variance',
vendor:'TCS',
children: [
{
vendor:'TCS',
year:'2013',
value:'95',
leaf: true
},
{
vendor:'TCS',
year:'2014',
value:'100',
leaf: true
}
]
},
{
sla: 'Variance',
vendor:'HCL',

year:'2014',
value:'93',
leaf: true

}
]

},
]
}
});
Ext.create('Ext.tree.TreePanel', {
renderTo: Ext.getBody(),
width: 1000,
height: 400,
title: 'People',
rootVisible:false,
store: store,
columns: [
{ xtype: 'treecolumn', header: 'SLA', dataIndex: 'sla', flex: 5 },
{ header: 'VENDOR', dataIndex: 'vendor', flex: 1 },
{ header: 'MONTH', dataIndex: 'year', flex: 1 },
{ header: 'VALUE', dataIndex: 'value', flex: 1 },

]
});

});


I am attaching my output.
On click of any value of YEAR or VALUE
I want to get its corresponding SLA Value.
Kindly suggest me a solution.

jsakalos
5 May 2014, 3:35 AM
This is duplicate of:http://www.sencha.com/forum/showthread.php?285010-HOW-TO-GET-THE-PARENT-VALUE-ON-CLICK-OF-CHILD-VALUE-IN-TREE-GRID

davidmanohar
5 May 2014, 4:37 AM
but this is not returning the value i need.
I should get the value of SLA.
But its returning the values tht is there in the particular clicked row.