aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/BaseEditDialogController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/BaseEditDialogController.js')
-rw-r--r--web/app/view/BaseEditDialogController.js22
1 files changed, 20 insertions, 2 deletions
diff --git a/web/app/view/BaseEditDialogController.js b/web/app/view/BaseEditDialogController.js
index df4db0e50..863a75dcb 100644
--- a/web/app/view/BaseEditDialogController.js
+++ b/web/app/view/BaseEditDialogController.js
@@ -19,9 +19,27 @@ Ext.define('Traccar.view.BaseEditDialogController', {
alias: 'controller.baseEditDialog',
onSaveClick: function(button) {
- var dialog = button.up('window').down('form');
+ var dialog, store, record;
+ dialog = button.up('window').down('form');
dialog.updateRecord();
- dialog.getRecord().save();
+ record = dialog.getRecord();
+ store = record.store;
+ if (store) {
+ if (record.phantom) {
+ store.add(record);
+ }
+ store.sync({
+ success: function() {
+ store.reload(); // workaround for selection problem
+ },
+ failure: function(batch) {
+ store.rejectChanges();
+ Traccar.ErrorManager.check(true, batch.exceptions[0].getResponse());
+ }
+ });
+ } else {
+ record.save();
+ }
button.up('window').close();
}
});