7

当我单击树面板中的节点时,我想添加允许空白的配置!如果节点是叶子,我想输入名称字段的配置:allowBlank:false,如果不是叶子,allowBlank:true。我没有找到方法来做到这一点?!

非常感谢 :)


感谢您的回答,但我的组合框不是全局变量:

var monPrepanel = Ext.create('Ext.form.Panel',{

        frame : true,
        title : 'Editing Zone',
        //renderTo : 'mesfields',
        //width : 750,
        forceFit : true,

        items: [{

                xtype:'fieldset',
                title: 'Add Task : ',
                margin : '20 20 20 20',

                collapsible: true,
                defaultType: 'textfield',
                defaults: {anchor: '100%'},
                layout: 'anchor',
                items: [ {

                itemId : 'p0',
                allowBlank : false,


         xtype : 'textfield',
    anchor : '60%',

         padding : '0 30 0 30',
          fieldLabel : 'Task',

          name : 'task'
        } , {

                itemId : 'p1',
                allowBlank : false,


         xtype : 'combobox',
            anchor : '40%',
            store : materialstore,
            queryMode: 'local',
            displayField: 'data',
            width : 50,
            valueField: 'data',
            editable : false,

         padding : '0 30 0 30',
          fieldLabel : 'Material',

          name : 'material'
        } , {

                allowBlank : true,

         xtype : 'combobox',
            anchor : '40%',
            store : ccstore,
            queryMode: 'local',
            displayField: 'data',
            width : 50,
            valueField: 'data',
            editable : false,

         padding : '0 30 0 30',
          fieldLabel : 'CC',

          name : 'cc'
        }

我可能需要通过 id 访问组合框组件?有没有解决方案可以将此组件访问到项目到项目?

4

2 回答 2

15

id为所需的组合框 ( )设置一个属性id: 'anyId',然后使用Ext.apply(Ext.getCmp('anyId'), {your config object});

于 2011-05-24T11:30:01.407 回答
5

通常,这就是您如何将更改“应用”到您已经创建的 Ext 组件。

var combo = new Ext.form.ComboBox({some initial config});

Ext.apply(combo, {your config object});

你是如何加载你的树节点的?如果从后端添加这些属性,您可能会做得更好。

于 2011-05-23T23:37:28.517 回答