开发者

How to adding field's config on the fly?

I want to adding allow Blanks 's config when i click on a node in my Tree Panel ! if node i开发者_如何转开发s a leaf , i want to put name field's config : allowBlank : false and if not a leaf , allowBlank : true . I don't find method to do this ?!

Thanks a lot :)


Thanks to your answer but my combobox is not a global variable :

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'
        }

I need to access to the combobox component by id maybe ? There are solutions to acess to this component into items to items ?


Set an id property for the desired combo box (id: 'anyId'), and use Ext.apply(Ext.getCmp('anyId'), {your config object});


In general, this is how you "apply" changes to an Ext component that you have already created.

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

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

How are you loading your Treenodes? You will probably do better by adding those properties from the back end if that's where it comes from.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜