Skip to content
Snippets Groups Projects
Commit 646c336e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Fix a bug in the rowEditorBase.resetFields.

Improve the require option for the App.grid.Panel.
More robust direct proxy. The trandsaction with undefined id are
abandoned. It happens when the Proxy is not yet ready !
parent c088df1a
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,10 @@
HEAD
- Fix a bug in resetFields parameters
- Add protection to avoid Direct transaction with null TableId.
It seems related to the fact that the proxy is not yet ready.
0.6.1.5 (Jul 2014)
- Add the configuration paremeter resetFields in the RowEditorBase
It allows to reset any fields when duplcating a record.
......
......@@ -96,7 +96,7 @@ Ext.define('App.data.proxy.Direct', {
params = request.params,
args = [],
i,
fieldId,
fieldId = App.encodeField(operation.params.tableName, 'id'),
fn,
method,
records;
......@@ -125,21 +125,32 @@ Ext.define('App.data.proxy.Direct', {
case 'update':
params.records = request.jsonData;
// abandon the update if the proxy is not yet ready
for (i = 0; i < params.records; i +=1) {
if (!params.records[fieldId]) {
return;
}
}
args.push(params);
break;
case 'destroy':
// build the name of the field id
fieldId = App.encodeField(operation.params.tableName, 'id');
// build the list of id to be destroy
records = operation.getRecords();
params.records = [];
records = operation.getRecords();
for (i = 0; i < records.length; i += 1) {
params.records.push(records[i].get(fieldId));
}
// abandon the transaction if the proxy is not yet ready
if (records === null || params.records.length === 0) {
return;
}
args.push(params);
break;
}
......
......@@ -14,7 +14,12 @@ Ext.define('App.grid.Panel', {
extend: 'Ext.grid.Panel',
alias: 'widget.xgrid',
requires: [
'Ext.grid.column.Boolean',
'Ext.grid.column.CheckColumn',
'Ext.grid.column.Date',
'Ext.grid.column.Number',
'Ext.grid.column.RowNumberer',
'Ext.grid.column.Template',
'App.grid.plugin.Paging',
'App.grid.plugin.RowEditorConfirmDelete',
'App.grid.plugin.RowEditorContextMenu',
......
......@@ -24,7 +24,7 @@ Ext.define('App.grid.plugin.RowEditorBase', {
* their name defined in the Ext.data.Field.
* A typical example is the reset of a status from OK to undefined.
*/
resetFields: [],
resetFields: null,
// Pre-defined configuration
pluginId: 'rowEditor',
......@@ -75,7 +75,11 @@ Ext.define('App.grid.plugin.RowEditorBase', {
table = App.getTableName(grid.getStore());
Dbui.getForm(table, this.addFormPanel, this);
// On duplicate the field id is reset
// initialise the list of fields to be reset on duplicate
// the field id is mandatory
if (!this.pluginConfig.resetFields) {
this.resetFields = [];
}
this.resetFields.push(App.encodeField(table, 'id'));
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment