diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-07 17:05:08 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-07 17:05:08 +1200 |
commit | ff266d342ae3c6922005f043470ef659447882b5 (patch) | |
tree | 589e5a45d9e9e91f6a49dde924b4f1f595db6513 /web/app/view | |
parent | 03844562307a8ed156d60a9d06c239c4d3092ea2 (diff) | |
download | trackermap-server-ff266d342ae3c6922005f043470ef659447882b5.tar.gz trackermap-server-ff266d342ae3c6922005f043470ef659447882b5.tar.bz2 trackermap-server-ff266d342ae3c6922005f043470ef659447882b5.zip |
Create separate class for tree store
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/Devices.js | 11 | ||||
-rw-r--r-- | web/app/view/DevicesController.js | 49 |
2 files changed, 1 insertions, 59 deletions
diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index d1d799944..70e11aab5 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -26,16 +26,7 @@ Ext.define('Traccar.view.Devices', { controller: 'devices', rootVisible: false, - store: { - type: 'tree', - parentIdProperty: 'groupId', - proxy: { - type: 'memory', - reader: { - type: 'json' - } - } - }, + store: 'DevicesTree', title: Strings.deviceTitle, selType: 'rowmodel', diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index d45fd50a8..864e3f2aa 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -30,59 +30,10 @@ Ext.define('Traccar.view.DevicesController', { selectDevice: 'selectDevice', selectReport: 'selectReport' } - }, - store: { - '#Groups': { - datachanged: 'storeUpdate', - update: 'storeUpdate' - }, - '#Devices': { - datachanged: 'storeUpdate', - update: 'storeUpdate' - } } } }, - storeUpdate: function () { - var groupsStore, devicesStore, nodes = []; - groupsStore = Ext.getStore('Groups'); - devicesStore = Ext.getStore('Devices'); - - groupsStore.each(function (record) { - var groupId, node = { - id: 'g' + record.get('id'), - original: record, - name: record.get('name'), - leaf: true - }; - groupId = record.get('groupId'); - if (groupId !== 0 && groupsStore.indexOfId(groupId) !== -1) { - node.groupId = 'g' + groupId; - } - nodes.push(node); - }, this); - devicesStore.each(function (record) { - var groupId, node = { - id: 'd' + record.get('id'), - original: record, - name: record.get('name'), - status: record.get('status'), - lastUpdate: record.get('lastUpdate'), - leaf: true - }; - groupId = record.get('groupId'); - if (groupId !== 0 && groupsStore.indexOfId(groupId) !== -1) { - node.groupId = 'g' + groupId; - } - nodes.push(node); - }, this); - - this.getView().getStore().getProxy().setData(nodes); - this.getView().getStore().load(); - this.getView().expandAll(); - }, - init: function () { var readonly = Traccar.app.getServer().get('readonly') && !Traccar.app.getUser().get('admin'); this.lookupReference('toolbarAddButton').setVisible(!readonly); |