diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-10 15:05:22 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-10 15:05:22 +1200 |
commit | 6ba407056722a6ee1e4f97454e0e02a3aa21439e (patch) | |
tree | b060c634cd005ee168dc1fe5c19110ad4040b4eb /web/app | |
parent | 48e1381dcdf0431c7f8fe7cb676d6b2838a3f581 (diff) | |
download | traccar-server-6ba407056722a6ee1e4f97454e0e02a3aa21439e.tar.gz traccar-server-6ba407056722a6ee1e4f97454e0e02a3aa21439e.tar.bz2 traccar-server-6ba407056722a6ee1e4f97454e0e02a3aa21439e.zip |
Implement group filtering function
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/Devices.js | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index ef79e643b..3dd81eb05 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -68,12 +68,39 @@ Ext.define('Traccar.view.Devices', { queryMode: 'local', displayField: 'name', valueField: 'id', - flex: 1/* TODO, + flex: 1, listeners: { change: function () { - this.up('grid').store.filter('groupId', this.getValue()); + if (Ext.isNumber(this.getValue())) { + this.up('grid').store.filter({ + id: 'groupFilter', + filterFn: function(item) { + var groupId, group, groupStore, filter = true; + groupId = item.get('groupId'); + groupStore = Ext.getStore('Groups'); + + while (groupId) { + group = groupStore.getById(groupId); + if (group) { + if (group.get('id') === this.getValue()) { + filter = false; + break; + } + groupId = group.get('groupId'); + } else { + groupId = 0; + } + } + + return !filter; + }, + scope: this + }); + } else { + this.up('grid').store.removeFilter('groupFilter'); + } } - }*/ + } }, { xtype: 'tbtext', html: Strings.sharedSearch |