ExtJs 3 - How do I add a property to an existing item in items?
I need to add the property to an existing item FormPanel. code:
Application.TypesForm = Ext.extend(Ext.form.FormPanel, {
initComponent : function() {
Ext.apply(this, {
defaultType : 'textfield',
items : [
{
fieldLabel : 'Id',
typeAhea开发者_Python百科d : true,
name : 'id',
hiddenName : 'id',
hiddenValue : 'id',
valueField : 'id',
readOnly : true,
cls : 'disabled_field'
}
,{
xtype : 'ProductsVerticalsComboBox',
id : 'add_vertical_id',
editable : false
//readOnly : true, cls : 'disabled_field'
}
In edit mode, you need to register add_vertical_id - readOnly property and cls. And in append mode - they are not needed. I do so:
Ext.apply(Ext.getCmp('add_vertical_id'), {readOnly : true, cls : 'disabled_field'});
But not working. What I do wrong ??
decided
items : [
{
fieldLabel : 'Id',
typeAhead : true,
name : 'id',
hiddenName : 'id',
hiddenValue : 'id',
valueField : 'id',
readOnly : true,
cls : 'disabled_field',
// Disabled Vertical combobox when id is not empty.
listeners: {
render: function() {
if (this.value) {
Ext.apply(Ext.getCmp('add_vertical_id'), {
readOnly : true,
cls : 'disabled_field'
});
}
}
}
}
,{
xtype : 'ProductsVerticalsComboBox',
id : 'add_vertical_id',
editable : false
}
精彩评论