,editor: { xtype: 'textfield' }
,editor: { xtype: 'modx-combo-usergroup' ,renderer: true}
Supports.grid.Supports = function(config) {
config = config || {};
Ext.applyIf(config,{
id: ’supports-grid-supports’
,url: Supports.config.connectorUrl
,baseParams: { action: ’mgr/supports/getList’ }
,fields: [’id’,’name’,’ym’]
,paging: true
,remoteSort: true
,anchor: ’97%’
,autoExpandColumn: ’name’
,save_action: ’mgr/supports/updateFromGrid’
,autosave: true
,columns: [{
header: _(’id’)
,dataIndex: ’id’
,sortable: true
,width: 60
},{
header: _(’supports.name’)
,dataIndex: ’name’
,sortable: true
,width: 100
,editor: { xtype: ’textfield’ }
},{
header: _(’supports.ym’)
,dataIndex: ’ym’
,sortable: true
,width: 350
,editor: { xtype: ’textfield’ }
},{
header: _(’supports.active’)
,dataIndex: ’active’
,sortable: false
,width: 350
,editor: { xtype: ’active-combo’,renderer: true }
}]
,tbar:[{
xtype: ’textfield’
,id: ’supports-search-filter’
,emptyText: _(’supports.search’)
,listeners: {
’change’: {fn:this.search,scope:this}
,’render’: {fn: function(cmp) {
new Ext.KeyMap(cmp.getEl(), {
key: Ext.EventObject.ENTER
,fn: function() {
this.fireEvent(’change’,this);
this.blur();
return true;
}
,scope: cmp
});
},scope:this}
}
}
,{
text: _(’supports.support_create’)
,handler: { xtype: ’supports-window-support-create’ ,blankValues: true }
}]
,getMenu: function() {
var m = [{
text: _(’supports.support_update’)
,handler: this.updateSupport
},’-’,{
text: _(’supports.support_remove’)
,handler: this.removeSupport
}];
this.addContextMenuItem(m);
return true;
}
,updateSupport: function(btn,e) {
if (!this.updateSupportWindow) {
this.updateSupportWindow = MODx.load({
xtype: ’supports-window-support-update’
,record: this.menu.record
,listeners: {
’success’: {fn:this.refresh,scope:this}
}
});
} else {
this.updateSupportWindow.setValues(this.menu.record);
}
this.updateSupportWindow.show(e.target);
}
,removeSupport: function() {
MODx.msg.confirm({
title: _(’supports.support_remove’)
,text: _(’supports.support_remove_confirm’)
,url: this.config.url
,params: {
action: ’mgr/supports/remove’
,id: this.menu.record.id
}
,listeners: {
’success’: {fn:this.refresh,scope:this}
}
});
}
});
Supports.grid.Supports.superclass.constructor.call(this,config)
};
//Ext.extend(Supports.grid.Supports,MODx.grid.Grid);
Ext.extend(Supports.grid.Supports,MODx.grid.Grid,{
search: function(tf,nv,ov) {
var s = this.getStore();
s.baseParams.query = tf.getValue();
this.getBottomToolbar().changePage(1);
this.refresh();
}
});
Ext.reg(’supports-grid-supports’,Supports.grid.Supports);
Supports.combo.active = function(config) {
config = config || {};
Ext.applyIf(config,{
displayField: ’active’
,valueField: ’active’
,fields: [’active’, ’active’]
//,url: YourCMPName.config.connectorUrl
, store: [[’no’,’Inactive’],[’yes’,’Active’]]// this is the local values
,baseParams: { action: ’’ ,combo: true }
,mode: ’local’
,editable: false
});
Supports.combo.active.superclass.constructor.call(this,config);
};
Ext.extend(Supports.combo.active,MODx.combo.ComboBox);
Ext.reg(’active-combo’, Supports.combo.active);