大家好 我是一个开始与extjs和我有改变问题/设置项目布局,当我点击我的节点之一。EXTJS:TreePanel点击设置项目更改
这里我的ContentPanel:
var contentPanel = {
id: 'content-panel',
region: 'center', // this is what makes this panel into a region within the containing layout
layout: 'card',
margins: '2 5 5 0',
activeItem: 0,
border: false,
items: layoutExamples // HERE I WANT TO CHANGE DYNAMIC
};
我的 “听众” 我的树节点:
treePanel.getSelectionModel().on('select', function(selModel, record) {
if (record.get('leaf')) {
//Ext.getCmp('content-panel').layout.setActiveItem(record.getId() + '-panel'); <== It's work.
Ext.getCmp('content-panel').setActive(formPanel); // HERE I TRY TO CHANGE ITEM ON CLICK AND SET FORMPANEL
});
我的测试项目:
var formPanel = Ext.create('Ext.form.Panel', {
frame: true,
title: 'Form Fields',
width: 340,
bodyPadding: 5,
fieldDefaults: {
labelAlign: 'left',
labelWidth: 90,
anchor: '100%'
},
items: [{
xtype: 'textfield',
name: 'textfield1',
fieldLabel: 'Text field',
value: 'Text field value'
}, {
xtype: 'textfield',
name: 'password1',
inputType: 'password',
fieldLabel: 'Password field'
}, {
xtype: 'filefield',
name: 'file1',
fieldLabel: 'File upload'
}, {
xtype: 'textareafield',
name: 'textarea1',
fieldLabel: 'TextArea',
value: 'Textarea value'
} }]
});
所以,我的目标是改变项目我的内容面板时,我点击一个节点..!
非常感谢您的帮助好友!
哪里定义了formPanel?为什么不使用注释行? – 2011-05-30 15:43:18
FormPanel被定义onDocReady(如果我在contentPanel中执行“items:formpanel”我有我的项目,但它是静态的,我想改变点击(因为我有很多项目,一个节点)并且注释行用于更改布局(这是sencha样品),我只是想改变项目..谢谢。 – sloshy 2011-05-30 16:01:07