Hi All,

I'm looking for a way to programmaticaly get a UI component (to set read only property for example) by name.

I want to loop over a predefined array of field names, get their actual component and call setReadOnly on them.

How do I do this?

Like 0

Like

2 comments

Hi Jonas,



You can bind enabled property to a method in diff section like this:



 

define("UsrPage", [],
	function() {
	return {
		entitySchemaName: "UsrObject",
		details: /**SCHEMA_DETAILS*/ {} /**SCHEMA_DETAILS*/ ,
		diff: [
			{
				"operation": "insert",
				"name": "DATEb70c5501-1824-4750-9dc8-2c7ced38a192",
				"values": {
					"layout": {
						"colSpan": 6,
						"rowSpan": 1,
						"column": 18,
						"row": 0,
						"layoutName": "Header"
					},
					"bindTo": "UsrValidityDate",
					"enabled": {"bindTo": "myFunctionCheck"}
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 2
			},
			{
				"operation": "insert",
				"name": "LOOKUP94e30b0e-aa00-49bb-a050-0103e04cd0fa",
				"values": {
					"layout": {
						"colSpan": 7,
						"rowSpan": 1,
						"column": 0,
						"row": 0,
						"layoutName": "Header"
					},
					"bindTo": "UsrQuoteOwner",
					"enabled": {"bindTo": "myFunctionCheck"},
					"contentType": 5
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 3
			}
		],
		methods: {
			myFunctionCheck: function() {
				return false;
			}
		}
	};
});

Note, that more than one field can be bound to one property.



Does this work for you?



Regards,

Dmytro

That'll do. Should've thought about that myself! Thanks.

Show all comments