Hi all,
There is a requirement in which I have to make printable visible on the basis of selected lookup. I followed this article https://customerfx.com/article/showing-or-hiding-printables-based-on-a-value-for-the-selected-record-in-creatio/
It is working fine on the edit page and only showing printable which is matching with the condition, but the same is not reflecting on the section and showing the complete list of printable.
Method which I have added on section and edit page is :
methods: {
initQueryColumns: function(esq) {
this.callParent(arguments);
if (!esq.columns.contains("UsrDocumentRepositorySubtype")) {
esq.addColumn("UsrDocumentRepositorySubtype");
}
},
initCardPrintForms: function() {
this.callParent(arguments);
var printMenuItems = this.get(this.moduleCardPrintFormsCollectionName);
if (Ext.isEmpty(printMenuItems)) return;
printMenuItems.each(function(item) {
item.set("Visible", {bindTo: "getPrintMenuItemVisible"});
}, this);
},
getPrintMenuItemVisible: function(reportId) {
if (Ext.isEmpty(this.get("ActiveRow"))) return true;
var type = this.get("GridData").get(this.get("ActiveRow")).get("UsrDocumentRepositorySubtype") || { displayName: "" },
printMenuItems = this.get(this.moduleCardPrintFormsCollectionName),
item = printMenuItems.find(reportId);
if (Ext.isEmpty(item)) return;
switch (item.get("Caption")) {
case "Mining and Quarrying Questionnaire":
return type.displayValue === "Mining and Quarrying Questionnaire";
case "Alcohol Questionnaire":
return type.displayValue === "Alcohol Questionnaire";
default:
return true;
}
}
}
Output (Edit Page)
Output (Section)
Is there something which I am missing or any other workaround ?