Commit 827bddef55bec3aa5364b6ecc7f2529d18dcff1c

Authored by Benjamin Renard
1 parent b1fab76f

Fix save of a filtered TT / Catalog (#9392)

Showing 2 changed files with 24 additions and 8 deletions   Show diff stats
js/app/views/CatalogUI.js
... ... @@ -126,13 +126,18 @@ Ext.define('amdaUI.CatalogUI', {
126 126 Ext.Msg.confirm('Generate TT', 'Current Catalog has been modified.\nDo you want to save it to include these changes in the generated Time Table ?',
127 127 function (btn, text) {
128 128 if (btn == 'yes') {
  129 + var me = this;
129 130 // mark this.closed as true before the call to close() as that will fire the beforeclose event again
130 131 if (this.object.get('id') == "") {
131 132 // case of creation of catalog
132   - this.saveCatalog(true, true);
  133 + this.saveCatalog(function () {
  134 + me.createTT(me.object.get('id'));
  135 + }, true);
133 136 } else {
134 137 // casse existing catalog
135   - this.saveProcess(false, true, true);
  138 + this.saveProcess(false, function () {
  139 + me.createTT(me.object.get('id'));
  140 + }, true);
136 141 }
137 142 return;
138 143 }
... ... @@ -534,6 +539,13 @@ Ext.define('amdaUI.CatalogUI', {
534 539 me.updateCount();
535 540 //Statistical plugin
536 541 this.fireEvent("refresh");
  542 + },
  543 + prefetch: function (store, records, successful, operation, eOpts) {
  544 + if (operation && (operation.action == 'read'))
  545 + {
  546 + if (operation.response && operation.response.result && operation.response.result.success)
  547 + me.status = operation.response.result.status;
  548 + }
537 549 }
538 550 }
539 551 });
... ... @@ -546,7 +558,11 @@ Ext.define('amdaUI.CatalogUI', {
546 558 me.TTGrid.getSelectionModel().deselectAll();
547 559 //
548 560 // // clear filters
549   - // me.TTGrid.getStore().clearFilter(true);
  561 + if (me.TTGrid.filters) {
  562 + me.TTGrid.getStore().clearFilter(true);
  563 + me.TTGrid.filters.clearFilters();
  564 + }
  565 +
550 566 //
551 567 // clear sort
552 568 me.TTGrid.getStore().sorters.clear();
... ... @@ -622,11 +638,11 @@ Ext.define('amdaUI.CatalogUI', {
622 638 this.object = obj;
623 639 module.linkedNode.create({notDisplayMsg: notDisplayMsg, callback: function () {
624 640 if (onAfterSave)
625   - this.createTT(this.object.get('id'));
  641 + onAfterSave();
626 642 }, scope: this});
627 643 }
628 644 // if the name has been modified this is a creation
629   - else if (this.fclose()) {
  645 + else if (this.fclose() || this.status && (this.status.nbFiltered > 0)) {
630 646 if (this.object.isModified('name') || this.object.get('fromPlugin')) {
631 647 // if object already has an id : it's a 'rename' of an existing
632 648 if (this.object.get('id')) {
... ... @@ -648,14 +664,14 @@ Ext.define('amdaUI.CatalogUI', {
648 664 module.linkedNode.create({callback: function () {
649 665 module.linkedNode.update({notDisplayMsg: notDisplayMsg, callback: function () {
650 666 if (onAfterSave)
651   - this.createTT(this.object.get('id'));
  667 + onAfterSave();
652 668 }, scope: this}, "", notDisplayMsg);
653 669 }, scope: this});
654 670 } else {
655 671 //update
656 672 module.linkedNode.update({notDisplayMsg: notDisplayMsg, callback: function () {
657 673 if (onAfterSave)
658   - this.createTT(this.object.get('id'));
  674 + onAfterSave();
659 675 }, scope: this});
660 676 }
661 677 }
... ...
js/app/views/TimeTableUI.js
... ... @@ -194,7 +194,7 @@ Ext.define('amdaUI.TimeTableUI', {
194 194 // synchronisation of objects
195 195 this.object = ttobj;
196 196 timeTableModule.linkedNode.create();
197   - } else if (this.fclose()) /*TimeTable object has been modified*/
  197 + } else if (this.fclose() || this.status && (this.status.nbFiltered > 0)) /*TimeTable object has been modified*/
198 198 {
199 199 if (this.object.isModified('name') || this.object.get('fromPlugin'))
200 200 {
... ...