user1960836
user1960836

Reputation: 1782

Getting undefined on textarea

I am getting undefined on textareafield.. I have se the id to: msgArea, but extjs changes the id to: msgArea-inputEl on runtime. I have tried using both these ids, but getting undefined on both.

    isoNS.PanelQDisableInfoMsg = Ext.create("Ext.window.Window", {
    title: 'Improtant information', 
    width: $(document).width() / 2,
    height: $(document).height() / 3,
    modal: true,
    resizable: false,
    style: 'position: absolute; top: 100px;',
    id: 'infoWindow',
    layout: {
        align: 'stretch',
        type: 'vbox'
    },
    dockedItems: [
        {
            xtype: 'textareafield',
            fieldStyle: 'background-color: #DFE9F6; background-image: none;',
            readOnly: true,
            height: ($(document).height() / 3) - 80,
            inputId: 'msgArea',
        },
        {
            xtype: 'button',
            text: 'Ok',
            id: 'OkButton',
            docked: 'bottom',
            handler: function() {
                var win = Ext.getCmp("infoWindow");
                win.close();
            }
        },
        {
            xtype: 'button',
            text: 'Test',
            handler: function() {
                var textArea = Ext.getCmp("msgArea");
                textArea.setValue("Text changed");
            }
        }
    ]   
}).show();

The code that gives the undefined is this part:

{
    xtype: 'button',
    text: 'Test',
    handler: function() {
        var textArea = Ext.getCmp("msgArea-inputEl");
        textArea.setValue("Text changed");
    }
}

what am I doing wrong?

Also. How do I make extjs NOT to change the id on runtime from msgArea to: msgArea-inputEl?

Upvotes: 1

Views: 167

Answers (1)

Reporter
Reporter

Reputation: 3948

I don't know the exact version of your Extjs. The api on http://docs.sencha.com/extjs/4.0.7/ says:

inputId : String

The id that will be given to the generated input DOM element. Defaults to an automatically generated id. If you configure this manually, you must make sure it is unique in the document.

Available since: 4.0.0

If you uses an older version of Extjs, the api offers the object property id:. According these descriptions if you use this, the framework won't assign an automatic generated object id to this element.

Upvotes: 1

Related Questions