Title: Making list control read only in IBM Anywhere
Tags: javascript;maximo-anywhere
Question: I am calling an eventHandler on a list control in app.xml on render event.
The eventHandler calls the method correctly. I want to make the list readonly depending upon flag value.
readOnly : function(eventContext)
if (flag==true)
eventContext.setDisplay(true);
else
eventContext.setDisplay(false);
setDisplay method makes the list visible/non-visible depending upon flag value.
What is the correct way to make the list control read only?


Here is another answer: You get the metadata for the field, then set the property on that particular field.
//get the current record:
var currWO = eventContext.getResource().getCurrentRecord();
//set the readonly attribute to true.
currWO.getRuntimeFieldMetadata('fieldname').set('readonly'), true;

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:10/17/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<javascript><maximo-anywhere>', 'Title': 'Making list control read only in IBM Anywhere', 'ViewCount': 168, 'id': 46794827, 'user_AboutMe': '', 'user_AccountId': 7047054.0, 'user_DisplayName': 'Sakshi Joshi', 'user_Reputation': 21.0, 'user_Views': 21.0, 'user_id': 5397553.0}}