From 3df9db8f0a841e5f1020d6797083c73cc68e512c Mon Sep 17 00:00:00 2001 From: alex-petkevich Date: Thu, 25 Oct 2018 11:09:23 +0300 Subject: Fix bug with selecting device second times from the devices grid --- web/app/view/edit/DevicesController.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'web/app/view/edit/DevicesController.js') diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 2b4ff14f..c1e46b79 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -118,6 +118,13 @@ Ext.define('Traccar.view.edit.DevicesController', { } }, + onClick: function (el, record) { + if (record !== undefined) { + this.updateButtons([record]); + this.fireEvent('selectdevice', record, true); + } + }, + selectDevice: function (device) { this.getView().getSelectionModel().select([device], false, true); this.updateButtons(this.getView().getSelectionModel().getSelected().items); -- cgit v1.2.3 From f953873700235a416f69eeed909cd73c59e1f32b Mon Sep 17 00:00:00 2001 From: alex-petkevich Date: Thu, 25 Oct 2018 16:24:52 +0300 Subject: Fix bug with selecting device second times from the devices grid --- web/app/view/edit/Devices.js | 4 ++-- web/app/view/edit/DevicesController.js | 11 +---------- 2 files changed, 3 insertions(+), 12 deletions(-) (limited to 'web/app/view/edit/DevicesController.js') diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index 2b2a874b..dfa855c8 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -75,8 +75,8 @@ Ext.define('Traccar.view.edit.Devices', { }, listeners: { - selectionchange: 'onSelectionChange', - rowclick: 'onClick' + rowclick: 'onSelectionChange', + itemkeyup: 'onSelectionChange' }, viewConfig: { diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index c1e46b79..120944b8 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -109,16 +109,7 @@ Ext.define('Traccar.view.edit.DevicesController', { this.lookupReference('deviceCommandButton').setDisabled(empty || readonly); }, - onSelectionChange: function (selection, selected) { - this.updateButtons(selected); - if (selected.length > 0) { - this.fireEvent('selectdevice', selected[0], true); - } else { - this.fireEvent('deselectfeature'); - } - }, - - onClick: function (el, record) { + onSelectionChange: function (el, record) { if (record !== undefined) { this.updateButtons([record]); this.fireEvent('selectdevice', record, true); -- cgit v1.2.3