we have a detail (Activity) with three editing pages (investigation, corrective actions, preventive actions) for which we must connect the click event of each detail so that the menu is filtered to obtain a specific page for each,
I implemented the code below but still not getting the result.
define("ClaSchema821f5cb2Detail", [], function() {
return {
entitySchemaName: "Activity",
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "merge",
"name": "AddTypedRecordButton",
"parentName": "Claims1PageClaSchema821f5cb2Detail2b214db7Container",
"propertyName": "items",
"values": {
"controlConfig": {
"menu": {
"items": {
"bindTo": "EnabledEditPages",
"bindConfig": {
"converter": function(editPages) {
return editPages;
/*if (editPages.getCount() >= 1) {
return editPages;
} else {
return null;
}*/
}
}
}
}
}
}
},
{
"operation": "merge",
"name": "AddTypedRecordButton",
"parentName": "Claims1PageClaSchema821f5cb2Detail682ca645Container",
"propertyName": "items",
"values": {
"controlConfig": {
"menu": {
"items": {
"bindTo": "EnabledEditPages2",
"bindConfig": {
"converter": function(editPages) {
return editPages;
/*if (editPages.getCount() >= 1) {
return editPages;
} else {
return null;
}*/
}
}
}
}
}
}
},
{
"operation": "merge",
"name": "AddTypedRecordButton",
"parentName": "Claims1PageClaSchema821f5cb2Detail8ef4781dContainer",
"propertyName": "items",
"values": {
"controlConfig": {
"menu": {
"items": {
"bindTo": "EnabledEditPages3",
"bindConfig": {
"converter": function(editPages) {
return editPages;
/*if (editPages.getCount() >= 1) {
return editPages;
} else {
return null;
}*/
}
}
}
}
}
}
},
]/**SCHEMA_DIFF*/,
methods: {
initEditPages: function() {
console.log("initEditPagesinitEditPagesinitEditPagesinitEditPages");
var enabledEditPages = new this.Terrasoft.Collection();
var enabledEditPages2 = new this.Terrasoft.Collection();
var enabledEditPages3 = new this.Terrasoft.Collection();
this.callParent(arguments);
var editPages = this.getEditPages();
var items = editPages.getItems();
var item = items.filter(function(item){return item.get("SchemaName") == 'ClaActivityPageV21';});
enabledEditPages.add(item);
this.set("EnabledEditPages", enabledEditPages);
var item2 = items.filter(function(item){return item.get("SchemaName") == 'ClaActivityPageV23';});
enabledEditPages2.add(item2);
this.set("EnabledEditPages2", enabledEditPages2);
var item3 = items.filter(function(item){return item.get("SchemaName") == 'ClaActivityPageV24';});
enabledEditPages3.add(item3);
this.set("EnabledEditPages3", enabledEditPages3);
},
}
};
});
Like
Hello,
In the Detail schemas for each detail, you should write something like this:
define("UsrSchema26073b05Detail", [], function() { return { entitySchemaName: "Activity", details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, diff: /**SCHEMA_DIFF*/[ { "operation": "merge", "name": "AddTypedRecordButton", "values": { "click": {"bindTo": "openSpecificPage"}, } }, ]/**SCHEMA_DIFF*/, methods: { openSpecificPage: function() { if (!this.get("EditPages")) { this.initEditPages(); } var pages = this.get("EditPages"); var pageId = pages.collection.items.find((x) => x.values.Caption === "Call").values.Id; this.addRecord(pageId); }, } }; });
Just switch the Caption of the needed page (or use another parameter to distinguish pages) to the correct one in each schema.
Dmytro Vovchenko,
Can we do the same in freedon UI. Thanks in advance