diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/app/store/ReportEventTypes.js | 9 | ||||
-rw-r--r-- | web/app/view/ReportConfigController.js | 12 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/web/app/store/ReportEventTypes.js b/web/app/store/ReportEventTypes.js index c5840305a..27bc1fd5d 100644 --- a/web/app/store/ReportEventTypes.js +++ b/web/app/store/ReportEventTypes.js @@ -19,10 +19,7 @@ Ext.define('Traccar.store.ReportEventTypes', { extend: 'Ext.data.Store', fields: ['type', 'name'], - allEvents: '%', - - data: [{ - type: '%', - name: Strings.eventAll - }] + statics: { + allEvents: '%' + } }); diff --git a/web/app/view/ReportConfigController.js b/web/app/view/ReportConfigController.js index 5bd6ae7ef..64acb7403 100644 --- a/web/app/view/ReportConfigController.js +++ b/web/app/view/ReportConfigController.js @@ -21,7 +21,11 @@ Ext.define('Traccar.view.ReportConfigController', { init: function () { var store = this.lookupReference('eventTypeField').getStore(); - if (store.getCount() === 1) { + if (store.getCount() === 0) { + store.add({ + type: Traccar.store.ReportEventTypes.allEvents, + name: Strings.eventAll + }); Ext.create('Traccar.store.AllNotifications').load({ scope: this, callback: function (records, operation, success) { @@ -44,10 +48,10 @@ Ext.define('Traccar.view.ReportConfigController', { this.getView().callingPanel.deviceId = this.lookupReference('deviceField').getValue(); this.getView().callingPanel.groupId = this.lookupReference('groupField').getValue(); eventType = this.lookupReference('eventTypeField').getValue(); - if (eventType.indexOf(Ext.getStore('ReportEventTypes').allEvents) > -1) { - eventType = [Ext.getStore('ReportEventTypes').allEvents]; + if (eventType.indexOf(Traccar.store.ReportEventTypes.allEvents) > -1) { + eventType = [Traccar.store.ReportEventTypes.allEvents]; } else if (eventType.length === this.lookupReference('eventTypeField').getStore().getCount() - 1) { - eventType = [Ext.getStore('ReportEventTypes').allEvents]; + eventType = [Traccar.store.ReportEventTypes.allEvents]; } this.getView().callingPanel.eventType = eventType; this.getView().callingPanel.fromDate = this.lookupReference('fromDateField').getValue(); diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 4cc42456c..a4a5c6227 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -43,7 +43,7 @@ Ext.define('Traccar.view.ReportController', { if (this.eventType !== undefined) { dialog.lookupReference('eventTypeField').setValue(this.eventType); } else { - dialog.lookupReference('eventTypeField').setValue([Ext.getStore('ReportEventTypes').allEvents]); + dialog.lookupReference('eventTypeField').setValue([Traccar.store.ReportEventTypes.allEvents]); } if (this.fromDate !== undefined) { dialog.lookupReference('fromDateField').setValue(this.fromDate); |