Question

How to hide controls on a detail based on a condition on a page?

How to hide controls on a detail based on a condition on a page?

Like 0

Like

1 comments

The example on the Event page

define("EventPageV2", [], function() {
	return {
		entitySchemaName: "Event",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		messages: {
			"UsrShowDetailChanged": {
				mode: this.Terrasoft.MessageMode.PTP,
				direction: this.Terrasoft.MessageDirectionType.PUBLISH
			}
		},
		attributes: {
			"OnUsrShowDetailChangedAttribute": {
				"dependencies": [
					{
						"columns": ["UsrShowDetail"],
						"methodName": "onUsrShowDetailChanged"
					}
				]
			}
		},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "BOOLEAN9c795953-242f-4daf-81c5-479996042e97",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 2,
						"layoutName": "group1_gridLayout"
					},
					"bindTo": "UsrShowDetail",
					"enabled": true
				},
				"parentName": "group1_gridLayout",
				"propertyName": "items",
				"index": 4
			},
			{
				"operation": "move",
				"name": "StartDate",
				"parentName": "group_gridLayout",
				"propertyName": "items",
				"index": 0
			}
		]/**SCHEMA_DIFF*/,
		methods: {
			onUsrShowDetailChanged: function() {
				var usrShowDetail = this.get("UsrShowDetail");
				this.sandbox.publish("UsrShowDetailChanged", usrShowDetail, ["UsrShowDetailChangedKey"]);
			}
		},
		rules: {},
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/
	};
});
define("EventTeamDetailV2", [],
		function() {
			return {
				entitySchemaName: "EventTeam",
				messages: {
					"UsrShowDetailChanged": {
						mode: this.Terrasoft.MessageMode.PTP,
						direction: this.Terrasoft.MessageDirectionType.SUBSCRIBE
					}
				},
				attributes: {
					isDetailEditable: {
						dataValueType: Terrasoft.DataValueType.BOOLEAN,
						value: false
					}
				},
				methods: {
					subscribeSandboxEvents: function() {
						this.callParent(arguments);
						this.sandbox.subscribe("UsrShowDetailChanged", this.onUsrShowDetailChanged, this, ["UsrShowDetailChangedKey"]);
					},
					onUsrShowDetailChanged: function(usrShowDetail) {
						if (usrShowDetail) {
							this.set("isDetailEditable", true);
						} else {
							this.set("isDetailEditable", false);
						}
					},
					getAddRecordButtonVisible: function() {
						this.callParent(arguments);
						return this.get("isDetailEditable");
					},
					getToolsVisible: function() {
						this.callParent(arguments);
						return this.get("isDetailEditable");
					}
 
				}
			};
		}
);

 

Show all comments