1

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?

1 Answers1

0

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; 
Kasey
  • 307
  • 1
  • 8