From da14c04199fe22e6c8bdc02edb2fba7a7ab96a4c Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 30 Jan 2017 16:42:16 +0500 Subject: Reject changes in BasePermissionsController on failure --- web/app/view/BasePermissionsController.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/BasePermissionsController.js b/web/app/view/BasePermissionsController.js index e18badcc..2fb2d873 100644 --- a/web/app/view/BasePermissionsController.js +++ b/web/app/view/BasePermissionsController.js @@ -47,7 +47,7 @@ Ext.define('Traccar.view.BasePermissionsController', { }); }, - onBeforeSelect: function (object, record, index) { + onBeforeSelect: function (selection, record, index) { var data = {}; data[this.getView().baseObjectName] = this.getView().baseObject; data[this.getView().linkObjectName] = record.getId(); @@ -57,13 +57,14 @@ Ext.define('Traccar.view.BasePermissionsController', { jsonData: Ext.util.JSON.encode(data), callback: function (options, success, response) { if (!success) { + selection.deselect(record); Traccar.app.showError(response); } } }); }, - onBeforeDeselect: function (object, record, index) { + onBeforeDeselect: function (selection, record, index) { var data = {}; data[this.getView().baseObjectName] = this.getView().baseObject; data[this.getView().linkObjectName] = record.getId(); @@ -74,6 +75,7 @@ Ext.define('Traccar.view.BasePermissionsController', { jsonData: Ext.util.JSON.encode(data), callback: function (options, success, response) { if (!success) { + selection.select(record); Traccar.app.showError(response); } } -- cgit v1.2.3