PDA

View Full Version : Adding a treepanel gridpanel's cell



grtpk
28 Sep 2012, 6:53 AM
Hi everbody,

I want to show a treepanel in gridpanel's cells. That is possible? I have rendered column, but does not happen.


{
header: 'TreePanel',
dataIndex: 'Id',

editor: new Ext.tree.TreePanel({
width: '100%',
height: 200,
autoScroll:true,
root:
{
text: 8563,
id: '8563',
expanded: true
},
rootVisible: false,
loader: new Ext.tree.TreeLoader({
directFn: DataAction.GetShow,
paramOrder: ['node']
})


})
}

vietits
28 Sep 2012, 5:50 PM
Have a look at my component: Its.grid.column.Component (http://www.sencha.com/forum/showthread.php?174504-Its.grid.column.Component-Component-Column-for-Ext-4.0.7). It allows you to embed components in grid cells. Below is an example of using this component to render treepanel in grid cells.


Ext.require([
'Ext.*',
'Its.grid.column.Component'
]);


Ext.onReady(function(){
Ext.create('Ext.grid.Panel', {
renderTo: Ext.getBody(),
title: 'ITS Component Column Demo',
width: 500,
height: 300,
store: {
type: 'store',
fields: ['name', 'tree'],
data: [{
name: 'Tree 1',
tree: {
text: 'Tree 1 Root',
expanded: true,
children: [{
text: 'Node 1',
expanded: true,
children: [{
text: 'Node 1.1',
leaf: true
}]
},{
text: 'Node 2',
leaf: true
}]
}
},{
name: 'Tree 2',
tree: {
text: 'Tree 2 Root',
expanded: true,
children: [{
text: 'Node 1',
leaf: true
},{
text: 'Node 2',
expanded: true,
children: [{
text: 'Node 2.1',
leaf: true
}]
}]
}
}]
},
columns: [{
text: 'Name',
flex: 1,
dataIndex: 'name'
},{
xtype: 'itscomponentcolumn',
text : 'Tree Panel',
width: 400,
dataIndex: 'tree',
items: function(value){
return {
xtype: 'treepanel',
width: 380,
height: 100,
store: {
type: 'treestore',
fields: ['text'],
root: value
}
}
}
}]
});
});

Here is screenshot of example.
39034

grtpk
1 Oct 2012, 2:26 AM
thanks for your reply,

I use Ext 3.3 version. Can I use this component in 3.3 version ? How can I use this component in 3.3 version?

vietits
1 Oct 2012, 5:20 AM
I wrote this component for Ext 4.x. I am not sure whether or not it will work with Ext 3.3. I don't have experience with that version.