0
ExtJS4Treenode到GridView
我試圖將treenode移動到gridpanel。我希望將其關聯數據插入此處。但是,無論何時移動treenode,它都會在該位置創建一個空行。 我創建了樹:
var treeData = {
text: 'Business Processes',
children:[
{text: 'Process7', lob: 'Lob7', leaf:true},
{text: 'Process8', lob: 'Lob8', leaf:true},
{text: 'Process9', lob: 'Lob9', leaf:true},
{text: 'Process10', lob: 'Lob10', leaf:true},
{text: 'Process11', lob: 'Lob11', leaf:true},
{text: 'Process12', lob: 'Lob12', leaf:true}
]
};
bpTreeStore = Ext.create('Ext.data.TreeStore',{});
bpTreeStore.setRootNode(treeData);
new Ext.TreePanel({
id:'businessProcessTree',
store : bpTreeStore,
viewConfig: {
plugins:{
ptype: 'treeviewdragdrop',
dropGroup: 'dragGroup',
dragGroup: 'dragGroup',
dragText: 'Place the node to grid'
}
}
});
和電網作爲
Ext.define('BusinessProcessStoreModel',{
extend:'Ext.data.Model',
fields: [
{ name:'businessProcessName', type:'string' },
{ name:'businessProcessLob', type:'string' }
]
});
bpMappingStore = Ext.create('Ext.data.ArrayStore', {
model:'BusinessProcessStoreModel',
data:[
['Process1', 'Lob1'],
['Process2', 'Lob2'],
['Process3', 'Lob3']
]
});
var bpMappingGrid = Ext.create('Ext.grid.Panel',{
id:'bpGridPanel',
region:'center',
frame:true,
layout:'fit',
height:300,
columns:[
{ header:'Process Name', dataIndex:'businessProcessName' },
{ header:'Process Lob', dataIndex:'businessProcessLob' }
],
store:bpMappingStore,
viewConfig: {
plugins:{
ptype: 'gridviewdragdrop',
dropGroup: 'dragGroup',
dragGroup: 'dragGroup',
dragText: 'Place the node to grid'
},
listeners: {
drop: function(node, data, overModel, dropPosition)
{
var position = (dropPosition=='after'?overModel.index + 1: overModel.index -1);
Ext.getCmp('bpGridPanel').store.insert(position, [[data.records[0].data.text, 'LOB']]);
//data.records[0].data.lob is undefined don't know why
}
}
}
});
請告訴我如何借鑑「文」和樹節點的「吊射」被插入到網格面板的兩列。
我在這裏創建了我自己的