Have been looking all over and at various 'solutions' but nothing helped me to 'get it'. So far I have been debugging one set of issues that is related to not displaying data inserted in the database.
For instance when I insert the parent industry id into the parent field and the same happens with the image value, it will not be shown when I reload the records.
Sequence:
User creates a new industry record. Selects the parent from the combo box and the image using the modx-combo-browser.
The data is stored in the record on the database.
When opening the record for update the data is returned from the processor via the connector as json object correctly.
PROBLEM is that the fields do not any values in the editor.
Here the relevant parts:
Database table
mysql> desc projects_industry;
+-------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | | |
| description | text | NO | | NULL | |
| image | text | NO | | NULL | |
| parent | int(11) | NO | | 0 | |
| createdon | datetime | YES | | NULL | |
| createdby | int(10) unsigned | NO | | 0 | |
| editedon | datetime | YES | | NULL | |
| editedby | int(10) unsigned | NO | | 0 | |
+-------------+------------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)
industries.grid.js
Projects.window.UpdateIndustry = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('industries.project_update')
,url: Projects.config.connectorUrl
,baseParams: {
action: 'mgr/industry/update'
}
,fields: [{
xtype: 'hidden'
,name: 'id'
},{
xtype: 'Industries-combo'
,fieldLabel: _('industries.parent')
,name: 'parent'
,width: 200
},{
xtype: 'textfield'
,fieldLabel: _('industries.name')
,name: 'name'
,width: 300
},{
xtype: 'modx-combo-browser'
,fieldLabel: _('industries.image')
,name: 'image'
,width: 300
,hideFiles: true
},{
xtype: 'htmleditor'
,fieldLabel: _('industries.description')
,name: 'description'
,width: 300
}]
});
Projects.window.UpdateIndustry.superclass.constructor.call(this,config);
};
Ext.extend(Projects.window.UpdateIndustry,MODx.Window);
Ext.reg('projects-window-industry-update',Projects.window.UpdateIndustry);
industries.grid.js
Projects.combo.Industries = function(config) {
config = config || {};
Ext.applyIf(config,{
displayField: 'name'
,mode: 'remote'
,hiddenName: 'parent'
,valueField: 'id'
,fields: ['id', 'name']
,url: Projects.config.connectorUrl
,baseParams: { action: 'mgr/industry/getlist', combo: true }
,editable: false
,emptyText: 'Select industry...'
});
Projects.combo.Industries.superclass.constructor.call(this,config);
console.log(this);
};
Ext.extend(Projects.combo.Industries, MODx.combo.ComboBox);
Ext.reg('Industries-combo', Projects.combo.Industries);
json: mgr/industry/getlist
{"total":"4","results":[{"id":1,"name":"Industry 1","description":"","image":"","parent":"1","createdon":null,"createdby":0,"editedon":null,"editedby":0},{"id":2,"name":"Industry 2","description":"","image":"","parent":"1","createdon":null,"createdby":0,"editedon":null,"editedby":0},{"id":3,"name":"Industry 3","description":"","image":"","parent":"2","createdon":null,"createdby":0,"editedon":null,"editedby":0},{"id":4,"name":"Industry 4","description":"Industry 4\u200b","image":"assets\/images\/flags.jpg","parent":"3","createdon":null,"createdby":0,"editedon":null,"editedby":0}]}