diff options
author | tsmgeek <tsmgeek@gmail.com> | 2017-08-17 22:56:51 +0100 |
---|---|---|
committer | tsmgeek <tsmgeek@gmail.com> | 2017-08-17 22:56:51 +0100 |
commit | 2dbf091c950606c6f7f852fa2b7a9a71b6496433 (patch) | |
tree | 16ff4ceb687a1a5be5cc66a1e732cf2d6daf91dc /web/app/view/edit/AttributesController.js | |
parent | f8b4b7da1b5c1e394707b8ba11ec9879ffe20398 (diff) | |
download | trackermap-web-2dbf091c950606c6f7f852fa2b7a9a71b6496433.tar.gz trackermap-web-2dbf091c950606c6f7f852fa2b7a9a71b6496433.tar.bz2 trackermap-web-2dbf091c950606c6f7f852fa2b7a9a71b6496433.zip |
optimise ifthenelse & foreach loops
Diffstat (limited to 'web/app/view/edit/AttributesController.js')
-rw-r--r-- | web/app/view/edit/AttributesController.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/web/app/view/edit/AttributesController.js b/web/app/view/edit/AttributesController.js index 235f2c5b..8d159569 100644 --- a/web/app/view/edit/AttributesController.js +++ b/web/app/view/edit/AttributesController.js @@ -45,27 +45,31 @@ Ext.define('Traccar.view.edit.AttributesController', { } } store.addListener('add', function (store, records) { - var i; + var i, view; + view = this.getView(); for (i = 0; i < records.length; i++) { - this.getView().record.get('attributes')[records[i].get('name')] = records[i].get('value'); + view.record.get('attributes')[records[i].get('name')] = records[i].get('value'); } - this.getView().record.dirty = true; + view.record.dirty = true; }, this); store.addListener('update', function (store, record, operation) { + var view; + view = this.getView(); if (operation === Ext.data.Model.EDIT) { if (record.modified.name !== record.get('name')) { - delete this.getView().record.get('attributes')[record.modified.name]; + delete view.record.get('attributes')[record.modified.name]; } - this.getView().record.get('attributes')[record.get('name')] = record.get('value'); - this.getView().record.dirty = true; + view.record.get('attributes')[record.get('name')] = record.get('value'); + view.record.dirty = true; } }, this); store.addListener('remove', function (store, records) { - var i; + var i, view; + view = this.getView(); for (i = 0; i < records.length; i++) { - delete this.getView().record.get('attributes')[records[i].get('name')]; + delete view.record.get('attributes')[records[i].get('name')]; } - this.getView().record.dirty = true; + view.record.dirty = true; }, this); this.getView().setStore(store); |