开发者

ExtJs 3 - How do I add a property to an existing item in items?

开发者 https://www.devze.com 2023-04-12 04:39 出处:网络
I need to add the property to an existing item FormPanel. code: Application.TypesForm = Ext.extend(Ext.form.FormPanel, {

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

精彩评论

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