2017-10-17 87 views
1

我在渲染事件的app.xml中的列表控件上调用eventHandler。 eventHandler正确调用该方法。我想根据标志值只读列表。使列表控件在IBM Anywhere中为只读

readOnly : function(eventContext) 
{ 
    if (flag==true) 
     eventContext.setDisplay(true); 
    else 
     eventContext.setDisplay(false); 
} 

setDisplay方法根据标志值使列表可见/不可见。 什么是使列表控件只读的正确方法?

回答

0

您获取该字段的元数据,然后设置该特定字段的属性。

//get the current record: 
var currWO = eventContext.getResource().getCurrentRecord(); 
//set the readonly attribute to true. 
currWO.getRuntimeFieldMetadata('fieldname').set('readonly'), true;