diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-10 14:35:29 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-04-10 14:35:29 +1200 |
commit | 48e1381dcdf0431c7f8fe7cb676d6b2838a3f581 (patch) | |
tree | 504932e1b64694fcf421447614b40922b9b5eff6 | |
parent | f5a96bb1547dcfbddf26c05143874195b4a50d0f (diff) | |
download | trackermap-server-48e1381dcdf0431c7f8fe7cb676d6b2838a3f581.tar.gz trackermap-server-48e1381dcdf0431c7f8fe7cb676d6b2838a3f581.tar.bz2 trackermap-server-48e1381dcdf0431c7f8fe7cb676d6b2838a3f581.zip |
Implement new search filtering
-rw-r--r-- | web/app/view/Devices.js | 42 | ||||
-rw-r--r-- | web/app/view/DevicesController.js | 2 |
2 files changed, 26 insertions, 18 deletions
diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index eeaaf901b..ef79e643b 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -26,7 +26,13 @@ Ext.define('Traccar.view.Devices', { controller: 'devices', rootVisible: false, - store: 'Devices', + + initComponent: function() { + this.store = Ext.create('Ext.data.ChainedStore', { + source: 'Devices' + }); + this.callParent(); + }, title: Strings.deviceTitle, selType: 'rowmodel', @@ -53,7 +59,22 @@ Ext.define('Traccar.view.Devices', { }] }, - /*bbar: [{ + bbar: [{ + xtype: 'tbtext', + html: Strings.groupParent + }, { + xtype: 'combobox', + store: 'Groups', + queryMode: 'local', + displayField: 'name', + valueField: 'id', + flex: 1/* TODO, + listeners: { + change: function () { + this.up('grid').store.filter('groupId', this.getValue()); + } + }*/ + }, { xtype: 'tbtext', html: Strings.sharedSearch }, { @@ -61,23 +82,10 @@ Ext.define('Traccar.view.Devices', { flex: 1, listeners: { change: function () { - var tree, expr; - tree = this.up('treepanel'); - expr = new RegExp(this.getValue(), 'i'); - tree.store.filter({ - id: 'nameFilter', - filterFn: function (node) { - var children, len, visible, i; - children = node.childNodes; - len = children && children.length; - visible = node.isLeaf() ? expr.test(node.get('name')) : false; - for (i = 0; i < len && !(visible = children[i].get('visible')); i++); - return visible; - } - }); + this.up('grid').store.filter('name', this.getValue()); } } - }],*/ + }], listeners: { selectionchange: 'onSelectionChange' diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index 948a5d14e..e9a075ffc 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -44,7 +44,7 @@ Ext.define('Traccar.view.DevicesController', { onAddClick: function () { var device, dialog; device = Ext.create('Traccar.model.Device'); - device.store = this.getView().getStore(); + device.store = Ext.getStore('Devices'); dialog = Ext.create('Traccar.view.DeviceDialog'); dialog.down('form').loadRecord(device); dialog.show(); |