aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 16:01:23 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 16:01:23 +1200
commitb99246eb160e698039cbe929353477a9b2f672dd (patch)
treeb6929f5810cd6212ea6ce587f8fd7e375878d764
parentfe7b8bd58e23e289a041bc7c9a5d6c37f085419a (diff)
downloadtraccar-server-b99246eb160e698039cbe929353477a9b2f672dd.tar.gz
traccar-server-b99246eb160e698039cbe929353477a9b2f672dd.tar.bz2
traccar-server-b99246eb160e698039cbe929353477a9b2f672dd.zip
Fix issue with device selection
-rw-r--r--web/app/view/DevicesController.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index c61f8711b..3c1abfd8b 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -123,13 +123,17 @@ Ext.define('Traccar.view.DevicesController', {
}
},
- onSelectionChange: function (selected) {
+ updateButtons: function (selected) {
var empty = selected.getCount() === 0;
this.lookupReference('toolbarEditButton').setDisabled(empty);
this.lookupReference('toolbarRemoveButton').setDisabled(empty);
this.lookupReference('toolbarGeofencesButton').setDisabled(empty);
this.lookupReference('deviceCommandButton').setDisabled(empty || (selected.getLastSelected().get('status') !== 'online'));
- if (!empty) {
+ },
+
+ onSelectionChange: function (selected) {
+ this.updateButtons(selected);
+ if (selected.getCount() > 0) {
this.fireEvent('selectDevice', selected.getLastSelected(), true);
}
},
@@ -145,6 +149,6 @@ Ext.define('Traccar.view.DevicesController', {
},
onUpdateDevice: function (store, data) {
- this.onSelectionChange(this.getView().getSelectionModel());
+ this.updateButtons(this.getView().getSelectionModel());
}
});