2017-10-17 86 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;