aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/AttributesController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 13:26:33 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-09 13:26:33 +1200
commitfe7b8bd58e23e289a041bc7c9a5d6c37f085419a (patch)
treed28b58d1ea3b4fcd6c715c4f2d2e2e04cb91c208 /web/app/view/AttributesController.js
parent70d22de4205aec294660378f0d854cbc32c7a6b8 (diff)
downloadtrackermap-server-fe7b8bd58e23e289a041bc7c9a5d6c37f085419a.tar.gz
trackermap-server-fe7b8bd58e23e289a041bc7c9a5d6c37f085419a.tar.bz2
trackermap-server-fe7b8bd58e23e289a041bc7c9a5d6c37f085419a.zip
Fix issues in JavaScript code
Diffstat (limited to 'web/app/view/AttributesController.js')
-rw-r--r--web/app/view/AttributesController.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/web/app/view/AttributesController.js b/web/app/view/AttributesController.js
index 663b6eae3..3028e41eb 100644
--- a/web/app/view/AttributesController.js
+++ b/web/app/view/AttributesController.js
@@ -24,29 +24,32 @@ Ext.define('Traccar.view.AttributesController', {
],
init: function () {
- var store, propertyName, i = 0;
+ var store, propertyName, i = 0, attributes;
store = Ext.create('Traccar.store.Attributes');
store.setProxy(Ext.create('Ext.data.proxy.Memory'));
- for (propertyName in this.getView().record.get('attributes')) {
- store.add(Ext.create('Traccar.model.Attribute', {
- priority: i++,
- name: propertyName,
- value:this.getView().record.get('attributes')[propertyName]
- }));
+ attributes = this.getView().record.get('attributes');
+ for (propertyName in attributes) {
+ if (attributes.hasOwnProperty(propertyName)) {
+ store.add(Ext.create('Traccar.model.Attribute', {
+ priority: i++,
+ name: propertyName,
+ value: this.getView().record.get('attributes')[propertyName]
+ }));
+ }
}
- store.addListener('add', function (store , records , index , eOpts) {
- for (var i = 0; i < records.length; i++) {
+ store.addListener('add', function (store, records, index, eOpts) {
+ for (i = 0; i < records.length; i++) {
this.getView().record.get('attributes')[records[i].get('name')] = records[i].get('value');
this.getView().record.dirty = true;
}
}, this);
- store.addListener('update', function (store, record, operation , modifiedFieldNames , details , eOpts) {
+ store.addListener('update', function (store, record, operation, modifiedFieldNames, details, eOpts) {
if (operation === Ext.data.Model.EDIT) {
this.getView().record.get('attributes')[record.get('name')] = record.get('value');
this.getView().record.dirty = true;
}
}, this);
- store.addListener('remove', function (store , records , index , isMove , eOpts) {
+ store.addListener('remove', function (store, records, index, isMove, eOpts) {
delete this.getView().record.get('attributes')[records[index].get('name')];
this.getView().record.dirty = true;
}, this);