From 56a5de3dc50e438884c5636c11f31e48bf19a15e Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 19 Jun 2017 16:35:22 +0500 Subject: Retrieve store once --- web/app/AttributeFormatter.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 2ddfd61e..0c385672 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -63,9 +63,13 @@ Ext.define('Traccar.AttributeFormatter', { }, groupIdFormatter: function (value) { - var group; + var group, store; if (value !== 0) { - group = Ext.getStore(Ext.getStore('AllGroups').getTotalCount() === 0 ? 'Groups' : 'AllGroups').getById(value); + store = Ext.getStore('AllGroups'); + if (store.getTotalCount() === 0) { + store = Ext.getStore('Groups'); + } + group = store.getById(value); return group ? group.get('name') : value; } }, -- cgit v1.2.3