Mercurial > lada > lada-client
changeset 969:d4603049cd42
Fixed edit status. Only the last record is editable.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 12 Nov 2015 17:38:57 +0100 |
parents | 8fabf9a3fee7 |
children | f4eb53ba63fc |
files | app/controller/grid/Status.js app/view/grid/Status.js |
diffstat | 2 files changed, 6 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controller/grid/Status.js Thu Nov 12 16:15:37 2015 +0100 +++ b/app/controller/grid/Status.js Thu Nov 12 17:38:57 2015 +0100 @@ -93,23 +93,17 @@ toggleAllowedPermissions: function(context, record, index){ //retrieve the readOnly parameters - var readonlyWin = context.view.up('window').record.get('readonly'); - //var statusEdit = context.view.up('window').record.get('statusEdit'); + var statusEdit = context.view.up('window').record.get('statusEdit'); - var readonlyRec = record.get('readonly'); var grid = context.view.up('grid'); //retrieve the last record of the store - var lastRecord = context.getStore().last() + var lastRecord = context.getStore().last(); //Check if edit is allowed - if (lastRecord == record && - readonlyWin == false && - readonlyRec == false) { - grid.getPlugin('rowedit').enable() - } - else { - grid.getPlugin('rowedit').disable() + if (lastRecord != record || + statusEdit === false) { + grid.getPlugin('rowedit').cancelEdit(); } }
--- a/app/view/grid/Status.js Thu Nov 12 16:15:37 2015 +0100 +++ b/app/view/grid/Status.js Thu Nov 12 17:38:57 2015 +0100 @@ -38,20 +38,7 @@ clicksToMoveEditor: 1, autoCancel: false, disabled: true, - pluginId: 'rowedit', - listeners:{ - // Make row ineditable when readonly is set to true - // Normally this would belong into a controller an not the view. - // But the RowEditPlugin is not handled there. - beforeedit: function(e, o) { - var readonlywin = o.grid.up('window').record.get('readonly'); - var readonlygrid = o.record.get('readonly'); - if (readonlywin == true || readonlygrid == true || this.disabled) { - return false; - } - return true; - } - } + pluginId: 'rowedit' }); this.plugins = [this.rowEditing]; @@ -172,16 +159,9 @@ setReadOnly: function(b) { if (b == true){ //Readonly - if (this.getPlugin('rowedit')){ - this.getPlugin('rowedit').disable(); - } this.down('button[action=add]').disable(); }else{ //Writable - if (this.getPlugin('rowedit')){ - this.getPlugin('rowedit').enable(); - } - //this.down('button[action=delete]').enable(); this.down('button[action=add]').enable(); } }