Hi all,
I added a new file custom/clients/base/views/merge-duplicates/merge-duplicates.js to my code to extend the Merge Duplicate Process with some logic. My logic is running fine, but I also want to display an Alert message for the user before my logic is executed.
However, it is not shown until the merge is finished.
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// custom/clients/base/views/merge-duplicates/merge-duplicates.js :
({
extendsFrom: 'MergeDuplicatesView',
_savePrimary: function () {
app.alert.show('my_alert', {
level: 'info',
messages: 'Please wait ...'
});
// ... execute some logic ...
this._super('_savePrimary');
app.alert.dismiss('my_alert');
},
...
})
I also tried to place the app.alert.show inside the triggerSave() function or other functions.
But after merge_confirmation (Standard Code below) is shown in the GUI and confirmed - no other app.alert.show works:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// clients/base/views/merge-duplicates/merge-duplicates.js:
triggerSave: function() {
var self = this,
alternativeModels = _.without(this.collection.models, this.primaryRecord),
alternativeModelNames = [];
_.each(alternativeModels, function(model) {
alternativeModelNames.push(app.utils.getRecordName(model));
}, this);
this.clearValidationErrors(this.getFieldNames());
app.alert.show('merge_confirmation', {
level: 'confirmation',
messages: app.lang.get('LBL_MERGE_DUPLICATES_CONFIRM') + ' ' +
// FIXME needs to be removed on SC-4494.
Handlebars.Utils.escapeExpression(alternativeModelNames.join(', ')) + '. ' +
app.lang.get('LBL_MERGE_DUPLICATES_PROCEED'),
onConfirm: _.bind(this._savePrimary, this)
});
},
If i place app.alert into the _delegateEvents() function. My alert is shown, but already before the Save Button is clicked.
Can you help me on this?