How can I open a section from a card and pass parameters to it, I try this
const config = { caption: caption, entitySchemaName: "Account", schemaName: "AccountSectionV2", moduleId: "SectionModuleV2_AccountSectionV2" }; var newHash = "SectionModuleV2/AccountSectionV2"; this.sandbox.publish("PushHistoryState", { hash: newHash, silent: true, stateObj: { caption: config.caption, entitySchemaName: config.entitySchemaName, schemaName: config.schemaName, } }); this.sandbox.loadModule("SectionModuleV2", { renderTo: "centerPanel", id: config.moduleId, keepAlive: true, parameters: { "OBSWAccountFilterConfig": this.getFilters(), }, });
The section opens but the parameters I cannot get. How to open a section and get the parameters passed?
Like
Dear Grigoriy,
You can see the example of implementation of passing parameters in loadModule and then getting parameters in the method onContactEnrichmentPageVisibilityChanged in MainHeaderSchema:
onContactEnrichmentPageVisibilityChanged: function(tag) {
var args = Ext.decode(tag);
var showEnrichmentPage = args.isVisible;
this.set("ContactEnrichmentPageVisible", showEnrichmentPage);
if (!showEnrichmentPage) {
return;
}
this.sandbox.loadModule("BaseSchemaModuleV2", {
renderTo: this.get("ContactEnrichmentModuleContainerId"),
instanceConfig: {
parameters: {
viewModelConfig: {
ContactId: args.contactId,
ContactName: args.contactName,
EnrchTextDataId: args.enrchTextDataId,
EnrchEmailDataId: args.enrchEmailDataId,
CallerSource: args.source
}
},
schemaName: "ContactEnrichmentSchema",
isSchemaConfigInitialized: true,
useHistoryState: false
}
});
}
After that, the parameters are accessed in BaseSchemaModuleV2 in the getViewModelConfig method:
getViewModelConfig: function() {
var viewModelConfig = {
Ext: this.Ext,
sandbox: this.sandbox,
Terrasoft: this.Terrasoft
};
var parameters = this.parameters;
if (this.Ext.isObject(parameters)) {
viewModelConfig.values = parameters.viewModelConfig;
}
return viewModelConfig;
}
Best regards,
Dennis