aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-15 18:48:17 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-07-15 18:48:17 +1200
commit8a48bca94e9d76bdae60453ca0231543e66c378e (patch)
tree6f74a2b17cc882c19fe0951c75663c00e09906b4 /web/app
parent167dec228bf9227fbf1f9fa4a428b8bb309c5f94 (diff)
downloadtrackermap-web-8a48bca94e9d76bdae60453ca0231543e66c378e.tar.gz
trackermap-web-8a48bca94e9d76bdae60453ca0231543e66c378e.tar.bz2
trackermap-web-8a48bca94e9d76bdae60453ca0231543e66c378e.zip
Remove only not referenced positions
Diffstat (limited to 'web/app')
-rw-r--r--web/app/view/EventsController.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js
index 1737f264..16b3c779 100644
--- a/web/app/view/EventsController.js
+++ b/web/app/view/EventsController.js
@@ -47,12 +47,13 @@ Ext.define('Traccar.view.EventsController', {
},
onRemoveClick: function (button) {
- var event = this.getView().getSelectionModel().getSelection()[0];
+ var event, positionId;
+ event = this.getView().getSelectionModel().getSelection()[0];
if (event) {
Ext.getStore('Events').remove(event);
- if (event.get('positionId')) {
- Ext.getStore('EventPositions').remove(
- Ext.getStore('EventPositions').getById(event.get('positionId')));
+ positionId = event.get('positionId');
+ if (positionId && !Ext.getStore('Events').findRecord('positionId', positionId, 0, false, false, true)) {
+ Ext.getStore('EventPositions').remove(Ext.getStore('EventPositions').getById(positionId));
}
}
},