Hi community!
I add a button section but i want it don't show when I open edit page. In this case, i add a section button on Contact Section. I show images below
Regards,
Thanks you!
Like
Hello Ezequiel,
You need to define an attribute that will determine the visibility of your button. By default, it will be true. Then you need to override onCardRendered method in your replacing schema for Contact Section and set the attribute as false.
Please, see my example:
define("ContactSectionV2", [],
function() {
return {
entitySchemaName: "Contact",
attributes: {
"ButtonVisible": {
"dataValueType": Terrasoft.DataValueType.BOOLEAN,
"type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
"value": true
}
},
messages: {},
methods: {
onCardRendered: function() {
this.callParent();
this.set("ButtonVisible", false);
}
},
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"parentName": "ActionButtonsContainer",
"propertyName": "items",
"name": "MainContactSectionButton",
"values": {
itemType: Terrasoft.ViewItemType.BUTTON,
caption: { bindTo: "Resources.Strings.TestButton" },
"visible": {bindTo: "ButtonVisible"},
"layout": {
"column": 1,
"row": 6,
"colSpan": 1
}
}
}
]/**SCHEMA_DIFF*/
};
});
Tetiana Markova,
Hi! I wanted to use this code also, but i have a question. Where do I insert the name of my button?
Tetiana Markova,
I don't know if you are still following this thread, but the problem with this method is that when the user closes the edit page the button is not restored to the section list page. Any solution?
Thanks,
The way I got round the above was to include the following method:
showSection: function() { this.callParent(); this.set("ButtonVisible", true); },
This reshows the buttons. This is purely a hack and unofficial, caveat emptor.