I thought I was being efficient by loading reusable form items into an array, then pulling the array into the
fields option in my Create, Update, Duplicate window functions. The aim was to avoid listing the same 15 fields 3 times in my js code, with less bloat and changes only needed in one instance rather than 3.
Like this:
var ft = [];
ft.push([
{
xtype: 'modx-combo-browser'
,fieldLabel: 'Logo'
,name: 'logo'
,etc...
},{
xtype: '...' // more fields after this
}
]);
MyCmp.window.UpdateItem = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('update')
,url: MyCmp.config.connectorUrl
,baseParams: {
action: 'mgr/update'
}
,layout: 'form'
,fields: ft // array inserted here
});
MyCmp.window.UpdateItem.superclass.constructor.call(this,config);
};
However this causes all kinds of problems with combobox and file-browser not being configured when the window opens.
Is there any config option to get around this or am I stuck with the inefficient route...?