View Full Version : How get column Id in Tree Panel

30 May 2014, 4:10 AM
var treePanel = Ext.create('Ext.tree.Panel', {
id: 'tree-panel',
title: 'Sample Layouts',
region: 'north',
split: true,
height: 560,
minSize: 150,
rootVisible: false,
autoScroll: true,
store: store,
columns: [{
xtype: 'treecolumn',
text: 'name',
flex: 2.5,
sortable: true,
dataIndex: 'name'
}, {
text: 'id', //I want to get this id
flex: 1,
dataIndex: 'id',
sortable: true
}, {
text: 'Done',
dataIndex: 'done',
width: 55,
stopSelection: false,
menuDisabled: true,
listeners: {
renderer: function (value, metaData, record, rowIndex, colIndex, store, column) {
// My code...

How can i get column id or dataIndex in the rendered fuction

for example if the column is 'Done' how can i get its dataIndex 'done'
Please do help me in getting this since column["id"] is tree node id.

2 Jun 2014, 12:52 PM
I'm assuming you're wanting to do this in a renderer config, not in a render listener base on the arguments in your function? If so, you can get a column using its index using the grid's headercontainer's getHeaderAtIndex method like in the example below.