我正在尝试在SharePoint页面的表格视图中显示SharePoint文档库的值(文档类型,所有者,日期等列)。
列"文档类型"是查找值,所有者是人员选取器值。此值也可以为空。因此,在检索并显示它之前,我需要检查这些值是否为空。
对于文档类型,以下代码有效,但不适用于人员选择器字段:
if (currentItem.get_item('DocumentType') != null) {
documentType = currentItem.get_item('DocumentType').get_lookupValue();
}
对于People Picker,我使用了以下代码:
if (currentItem.get_item('Author') != "") {
authorizer = currentItem.get_item('Author');
authorizerName = authorizer.get_lookupValue();
}