diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG index 88ecbca5b7c5db025cf0e747c3d3e85192e9196d..4bb962cafcc3b62f0a74056559f8ed12a05e7a36 100644 --- a/static/plugin_dbui/CHANGELOG +++ b/static/plugin_dbui/CHANGELOG @@ -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. diff --git a/static/plugin_dbui/src/data/proxy/Direct.js b/static/plugin_dbui/src/data/proxy/Direct.js index 58b8972cf39480745ee2663af205425983a1af77..7f1876fc1a318db0bbcfd9f6365852a335f19ab9 100644 --- a/static/plugin_dbui/src/data/proxy/Direct.js +++ b/static/plugin_dbui/src/data/proxy/Direct.js @@ -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; } diff --git a/static/plugin_dbui/src/grid/Panel.js b/static/plugin_dbui/src/grid/Panel.js index 793e504264fb056e66660bcc662b30668641c81c..be199de0fe9ef0ce49eb55ff2360b888088b5d98 100644 --- a/static/plugin_dbui/src/grid/Panel.js +++ b/static/plugin_dbui/src/grid/Panel.js @@ -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', diff --git a/static/plugin_dbui/src/grid/plugin/RowEditorBase.js b/static/plugin_dbui/src/grid/plugin/RowEditorBase.js index 46cecfd6c4b8eb6ec280695b279f035bb4f6243c..318c5b622b979c1b35d1641a8d9aff2426eccf18 100644 --- a/static/plugin_dbui/src/grid/plugin/RowEditorBase.js +++ b/static/plugin_dbui/src/grid/plugin/RowEditorBase.js @@ -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')); },