Add refreshPredefinedMciViewsByCode()

This commit is contained in:
Bryan Ashby 2018-01-31 22:41:13 -07:00
parent d244cd25fa
commit 783f142e20
1 changed files with 23 additions and 9 deletions

View File

@ -10,6 +10,7 @@ const Config = require('./config.js').config;
const stringFormat = require('../core/string_format.js');
const MultiLineEditTextView = require('../core/multi_line_edit_text_view.js').MultiLineEditTextView;
const Errors = require('../core/enig_error.js').Errors;
const { getPredefinedMCIValue } = require('../core/predefined_mci.js');
// deps
const async = require('async');
@ -423,4 +424,17 @@ exports.MenuModule = class MenuModule extends PluginModule {
++customMciId;
}
}
refreshPredefinedMciViewsByCode(formName, mciCodes) {
const form = _.get(this, [ 'viewControllers', formName] );
if(form) {
form.getViewsByMciCode(mciCodes).forEach(v => {
if(!v.setText) {
return;
}
v.setText(getPredefinedMCIValue(this.client, v.mciCode));
});
}
}
};