diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-22 23:01:39 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-22 23:01:39 +1200 |
commit | 9c46d4cffe47dab99e87111a5e33aa5246c771ab (patch) | |
tree | 95255eb0bf2d7e4cace2b8abc21472c4109e5735 /web/app/view/BaseEditDialogController.js | |
parent | ec04b5f12e13f041262c179fa103b7e4694d7327 (diff) | |
download | trackermap-server-9c46d4cffe47dab99e87111a5e33aa5246c771ab.tar.gz trackermap-server-9c46d4cffe47dab99e87111a5e33aa5246c771ab.tar.bz2 trackermap-server-9c46d4cffe47dab99e87111a5e33aa5246c771ab.zip |
Move device dialog to view folder
Diffstat (limited to 'web/app/view/BaseEditDialogController.js')
-rw-r--r-- | web/app/view/BaseEditDialogController.js | 22 |
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(); } }); |