ilhan
ilhan

Reputation: 8963

Applying settings in ExtJs

I have:

var cp = Ext.create('Extensible.calendar.CalendarPanel', {
    id: 'calendar-remote',
    eventStore: eventStore,
    calendarStore: calendarStore
});

And I want to apply an option to it:

readOnly: true

from an external function. I've used

Ext.apply(cp, {
      readOnly: true
});

but it didn't work.

Upvotes: 0

Views: 246

Answers (2)

TerryChen
TerryChen

Reputation: 71

Ext.define('EIM.view.calendar.Panel', {
    extend: 'Ext.panel.Panel',
    alias : 'widget.calendar_panel',
    ...
    initComponent: function() {
        this.readOnly = (1 === 1);//or anything else
        this.callParent(arguments);
        this.items = [
            {
                xtype : 'extensible.calendarpanel',
                readOnly: this.readOnly,
                eventStore: this.eventStore,
                ...
            }
        ];
    }
}

It should be work...

Upvotes: 0

Mchl
Mchl

Reputation: 62387

You need to apply all config settings before component is created. After that you can call setReadOnly() method (assuming your component inherits from Ext.form.field.Base)

Upvotes: 1

Related Questions