How to add field configuration on the fly?

I want to add allow blanks config when I click on node in my tree panel! if node is a leaf, I want to put the configuration of the name field: allowBlank: false and if not the leaf, allowBlank: true. I did not find a way to do this ?!

Many thanks:)


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 the combobox component by id, maybe? Are there solutions for accessing this component in elements for elements?

+7
source share
2 answers

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

+15
source

In general, this is how you “apply” changes to an already created Ext component.

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

How do you upload your Treenodes? You are likely to achieve more by adding these properties on the back side if this happens.

+5
source

All Articles