comparison app/controller/grid/Status.js @ 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 a2c2039bb5d9
children f4eb53ba63fc
comparison
equal deleted inserted replaced
968:8fabf9a3fee7 969:d4603049cd42
91 * or if the row can be removed 91 * or if the row can be removed
92 */ 92 */
93 toggleAllowedPermissions: function(context, record, index){ 93 toggleAllowedPermissions: function(context, record, index){
94 94
95 //retrieve the readOnly parameters 95 //retrieve the readOnly parameters
96 var readonlyWin = context.view.up('window').record.get('readonly'); 96 var statusEdit = context.view.up('window').record.get('statusEdit');
97 //var statusEdit = context.view.up('window').record.get('statusEdit');
98 97
99 var readonlyRec = record.get('readonly');
100 var grid = context.view.up('grid'); 98 var grid = context.view.up('grid');
101 99
102 //retrieve the last record of the store 100 //retrieve the last record of the store
103 var lastRecord = context.getStore().last() 101 var lastRecord = context.getStore().last();
104 102
105 //Check if edit is allowed 103 //Check if edit is allowed
106 if (lastRecord == record && 104 if (lastRecord != record ||
107 readonlyWin == false && 105 statusEdit === false) {
108 readonlyRec == false) { 106 grid.getPlugin('rowedit').cancelEdit();
109 grid.getPlugin('rowedit').enable()
110 }
111 else {
112 grid.getPlugin('rowedit').disable()
113 } 107 }
114 } 108 }
115 109
116 }); 110 });

http://lada.wald.intevation.org