Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to adding field's config on the fly?

Tags:

extjs

extjs4

I want to adding allow Blanks 's config when i click on a node in my Tree Panel ! if node is 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 ?

like image 413
Vincent Guesné Avatar asked May 23 '11 14:05

Vincent Guesné


1 Answers

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

like image 173
Giku Promitt Avatar answered Sep 22 '22 14:09

Giku Promitt