I have creating CMP pages in Revo and have some problems.
Same result in both IE and FF.
When initializing/first show of the grid, only values from the db, is shown, not the combos themselves.
After hitting refresh button, the combos are shown correctly, with correct values from the db.
#2 When double-clicking one ’grid-column’ and row in the grid, I can update the value and it is correctly stored in the db.
But, the visual presentation of all the rows for the column is changed to the changed value.
If I for instance change to ’English’ in the top row for column ’Lexicon’, all values in the grid in that column are changed to ’English’.
Note that the values in the database for the other rows (id’s) are not changed = this is a visual change only.
Hitting refresh button do not change the column values, only reload of page shows correct values.
See image: Grid after double-click to see lexicon column to english.
Note also that right-click and update works correctly, it is only update in grid that produces this result.
MODx.combo.Lexicon = function(config) {
config = config || {};
Ext.applyIf(config,{
displayField: 'name'
,valueField: 'id'
,fields: ['id', 'name']
,url: Testapp.config.connectorUrl
,baseParams: { action: 'mgr/lexicon/items' ,combo: true }
,editable: false
});
MODx.combo.Lexicon.superclass.constructor.call(this,config);
};
Ext.extend(MODx.combo.Lexicon, MODx.combo.ComboBox);
Ext.reg('testapp-region-combo-lexicon', MODx.combo.Lexicon);
MODx.combo.Currency = function(config) {
config = config || {};
Ext.applyIf(config,{
displayField: 'name'
,valueField: 'id'
,fields: ['id', 'name']
,url: Testapp.config.connectorUrl
,baseParams: { action: 'mgr/currency/items' ,combo: true }
,editable: false
});
MODx.combo.Currency.superclass.constructor.call(this,config);
};
Ext.extend(MODx.combo.Currency, MODx.combo.ComboBox);
Ext.reg('testapp-region-combo-currency', MODx.combo.Currency);
MODx.combo.Vat = function(config) {
config = config || {};
Ext.applyIf(config,{
displayField: 'name'
,valueField: 'id'
,fields: ['id', 'name']
,url: Testapp.config.connectorUrl
,baseParams: { action: 'mgr/vat/items' ,combo: true }
,editable: false
});
MODx.combo.Currency.superclass.constructor.call(this,config);
};
Ext.extend(MODx.combo.Vat, MODx.combo.ComboBox);
Ext.reg('testapp-region-combo-vat', MODx.combo.Vat);
Testapp.grid.Region = function(config) {
config = config || {};
Ext.applyIf(config, {
id: 'testapp-grid-region'
,url: Testapp.config.connectorUrl
,baseParams: { action: 'mgr/region/getlist' }
,fields: ['id','name', 'lexiconid', 'currencyid', 'vatid', 'desc']
,paging: true
,remoteSort: true
,anchor: '97%'
,autoExpandColumn: 'name'
,save_action: 'mgr/region/updateFromGrid'
,autosave: true
,columns: [{
header: _('id')
,dataIndex: 'id'
,sortable: true
,width: 40
}, {
header: _('testapp.region_name')
,dataIndex: 'name'
,sortable: true
,width: 150
,editor: { xtype: 'textfield', minLength: 1, maxLength: 64 }
}, {
header: _('testapp.region_lexicon')
,dataIndex: 'lexiconid'
,sortable: false
,width: 200
,editor: { xtype: 'testapp-region-combo-lexicon' ,renderer: true }
}, {
header: _('testapp.region_currency')
,dataIndex: 'currencyid'
,sortable: false
,width: 200
,editor: { xtype: 'testapp-region-combo-currency' ,renderer: true }
}, {
header: _('testapp.region_vat')
,dataIndex: 'vatid'
,sortable: false
,width: 200
,editor: { xtype: 'testapp-region-combo-vat' ,renderer: true }
}, {
header: _('testapp.default_desc')
,dataIndex: 'desc'
,sortable: false
,width: 200
,editor: { xtype: 'textfield' }
}]
,tbar:[{
xtype: 'textfield'
,id: 'region-search-filter'
,emptyText: _('testapp.default_search_here')
,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: _('testapp.region_create')
,handler: { xtype: 'testapp-window-region-create', blankValues: true }
}]
});
Testapp.grid.Region.superclass.constructor.call(this, config)
};
Ext.extend(Testapp.grid.Region, MODx.grid.Grid,{
search: function(tf, nv, ov) {
var s = this.getStore();
s.baseParams.query = tf.getValue();
this.getBottomToolbar().changePage(1);
this.refresh();
}
,getMenu: function() {
var m = [{
text: _('testapp.region_update')
,handler: this.updateRegion
},'-',{
text: _('testapp.region_remove')
,handler: this.removeRegion
}];
this.addContextMenuItem(m);
return true;
}
,updateRegion: function(btn, e) {
if (!this.updateRegionWindow) {
this.updateRegionWindow = MODx.load({
xtype: 'testapp-window-region-update'
,record: this.menu.record
,listeners: {
'success': {fn:this.refresh,scope:this}
}
});
} else {
this.updateRegionWindow.setValues(this.menu.record);
}
this.updateRegionWindow.show(e.target);
}
,removeRegion: function() {
MODx.msg.confirm({
title: _('testapp.region_remove')
,text: _('testapp.region_remove_confirm')
,url: this.config.url
,params: {
action: 'mgr/region/remove'
,id: this.menu.record.id
}
,listeners: {
'success': {fn:this.refresh,scope:this}
}
});
}
});
Ext.reg('testapp-grid-region', Testapp.grid.Region);
Testapp.window.UpdateRegion= function(config) {
config = config || {};
Ext.applyIf(config, {
title: _('testapp.region_update')
,url: Testapp.config.connectorUrl
,baseParams: { action: 'mgr/region/update' }
,fields: [{
xtype: 'hidden'
,name: 'id'
}, {
xtype: 'textfield'
,fieldLabel: _('testapp.region_name_mandatory')
,name: 'name'
,width: 150
,description: _('testapp.region_name_info')
,allowBlank: false
,minLength: 1
,maxLength: 64
}, {
xtype: 'testapp-region-combo-lexicon'
,fieldLabel: _('testapp.region_lexicon_mandatory')
,name: 'lexiconid'
,hiddenName: 'lexiconid'
,width: 150
,description: _('testapp.region_lexicon_info')
,allowBlank: false
}, {
xtype: 'testapp-region-combo-currency'
,fieldLabel: _('testapp.region_currency_mandatory')
,name: 'currencyid'
,hiddenName: 'currencyid'
,width: 150
,description: _('testapp.region_currency_info')
,allowBlank: false
}, {
xtype: 'testapp-region-combo-vat'
,fieldLabel: _('testapp.region_vat_mandatory')
,name: 'vatid'
,hiddenName: 'vatid'
,width: 150
,description: _('testapp.region_vat_info')
,allowBlank: false
}, {
xtype: 'textarea'
,fieldLabel: _('testapp.default_desc')
,name: 'desc'
,width: 300
,description: _('testapp.default_desc_info')
}]
});
Testapp.window.UpdateRegion.superclass.constructor.call(this,config);
};
Ext.extend(Testapp.window.UpdateRegion, MODx.Window);
Ext.reg('testapp-window-region-update', Testapp.window.UpdateRegion);
Testapp.window.CreateRegion = function(config) {
config = config || {};
Ext.applyIf(config, {
title: _('testapp.region_create')
,url: Testapp.config.connectorUrl
,baseParams: { action: 'mgr/region/create' }
,fields: [{
xtype: 'textfield'
,fieldLabel: _('testapp.region_name_mandatory')
,name: 'name'
,width: 150
,description: _('testapp.region_name_info')
,allowBlank: false
,minLength: 1
,maxLength: 64
}, {
xtype: 'testapp-region-combo-lexicon'
,fieldLabel: _('testapp.region_lexicon_mandatory')
,name: 'lexiconid'
,hiddenName: 'lexiconid'
,width: 150
,description: _('testapp.region_lexicon_info')
,allowBlank: false
}, {
xtype: 'testapp-region-combo-currency'
,fieldLabel: _('testapp.region_currency_mandatory')
,name: 'currencyid'
,hiddenName: 'currencyid'
,width: 150
,description: _('testapp.region_currency_info')
,allowBlank: false
}, {
xtype: 'testapp-region-combo-vat'
,fieldLabel: _('testapp.region_vat_mandatory')
,name: 'vatid'
,hiddenName: 'vatid'
,width: 150
,description: _('testapp.region_vat_info')
,allowBlank: false
}, {
xtype: 'textarea'
,fieldLabel: _('testapp.default_desc')
,name: 'desc'
,width: 300
,description: _('testapp.default_desc_info')
}]
});
Testapp.window.CreateRegion.superclass.constructor.call(this,config);
};
Ext.extend(Testapp.window.CreateRegion, MODx.Window);
Ext.reg('testapp-window-region-create', Testapp.window.CreateRegion);