aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/app/view/Notifications.js10
-rw-r--r--web/app/view/NotificationsController.js13
2 files changed, 13 insertions, 10 deletions
diff --git a/web/app/view/Notifications.js b/web/app/view/Notifications.js
index 2ae980afe..211e5cd15 100644
--- a/web/app/view/Notifications.js
+++ b/web/app/view/Notifications.js
@@ -39,7 +39,7 @@ Ext.define('Traccar.view.Notifications', {
}
}, {
text: Strings.notificationWeb,
- dataIndex: 'web',
+ dataIndex: 'attributes.web',
xtype: 'checkcolumn',
flex: 1,
listeners: {
@@ -47,11 +47,12 @@ Ext.define('Traccar.view.Notifications', {
checkChange: 'onCheckChange'
},
renderer: function (value, metaData, record) {
- return (new Ext.ux.CheckColumn()).renderer(record.getData().attributes.web, metaData);
+ var fields = this.dataIndex.split('\.',2);
+ return (new Ext.ux.CheckColumn()).renderer(record.get(fields[0])[fields[1]], metaData);
}
}, {
text: Strings.notificationMail,
- dataIndex: 'mail',
+ dataIndex: 'attributes.mail',
xtype: 'checkcolumn',
flex: 1,
listeners: {
@@ -59,7 +60,8 @@ Ext.define('Traccar.view.Notifications', {
checkChange: 'onCheckChange'
},
renderer: function (value, metaData, record) {
- return (new Ext.ux.CheckColumn()).renderer(record.getData().attributes.mail, metaData);
+ var fields = this.dataIndex.split('\.',2);
+ return (new Ext.ux.CheckColumn()).renderer(record.get(fields[0])[fields[1]], metaData);
}
}],
diff --git a/web/app/view/NotificationsController.js b/web/app/view/NotificationsController.js
index 1638e4520..a7c4290ca 100644
--- a/web/app/view/NotificationsController.js
+++ b/web/app/view/NotificationsController.js
@@ -45,16 +45,17 @@ Ext.define('Traccar.view.NotificationsController', {
}
});
},
-
+
onBeforeCheckChange: function (column, rowIndex, checked, eOpts) {
+ var fields = column.dataIndex.split('\.',2);
var record = this.getView().getStore().getAt(rowIndex);
- var attributes = record.getData().attributes;
- if (!attributes[column.dataIndex]) {
- attributes[column.dataIndex] = "true";
+ var data = record.get(fields[0]);
+ if (!data[fields[1]]) {
+ data[fields[1]] = "true";
} else {
- delete attributes[column.dataIndex];
+ delete data[fields[1]];
}
- record.set('attributes', attributes);
+ record.set(fields[0], data);
record.commit();
},