From 75ed21f2e12c02bc7a7231e3345c757d04693abb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 12 Apr 2016 20:52:36 +1200 Subject: Implement device groupping in grid --- web/app/view/Devices.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'web/app') diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 3dd81eb05..ae46ba080 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -29,13 +29,27 @@ Ext.define('Traccar.view.Devices', { initComponent: function() { this.store = Ext.create('Ext.data.ChainedStore', { - source: 'Devices' + source: 'Devices', + groupField: 'groupId' }); this.callParent(); }, title: Strings.deviceTitle, selType: 'rowmodel', + features: [{ + ftype: 'grouping', + groupHeaderTpl: Ext.create('Ext.XTemplate', '{name:this.getGroupName}', { + getGroupName: function (v) { + var groupId = Number(v); + if (groupId) { + return Ext.getStore('Groups').getById(groupId).get('name'); + } else { + return Strings.groupNoGroup; + } + } + }) + }], tbar: { xtype: 'editToolbar', -- cgit v1.2.3