开发者

Why can't I extend the default options for a ComboBox in EXTJS?

I have several combo boxes. I want to DRY up the default options so I did this:

var defaultComboOptions = {
    displayField开发者_如何学运维: 'name',
    emptyText: 'Select a site...',
    enableKeyEvents:  true,
    forceSelection: true,
    listWidth: 300,
    selectOnFocus: true,
    triggerAction: 'all',
    typeAhead: true,
    typeAheadDelay: 125,
    valueField: 'id',
    width: 150,
    xtype: 'combo'
};

var cbSites = new Ext.form.ComboBox(Ext.extend(defaultComboOptions, {
    id:"myId",
    x:200,
    y:100,
    listeners:{
    }
}));

I only want to put what's different in each instance of a combobox.

I could do this in JQuery with a $.Extend(.... but I'm just not understanding ExtJS.

Thanks


Ext.extend() is used to extend classes (deprecated in ExtJs 4). You should use Ext.apply() which works like $.extend in jQuery.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜