Primefaces 13 如何避免警告“无法自动确定‘lazy’属性,回退到 false。”

问题描述 投票:0回答:1

我正在使用 PF 13.0.3。我在 UITable 上收到此警告“无法自动确定

lazy
属性,回退为 false。要么在组件上定义
lazy
属性,要么确保
value
属性不会解析为
null
。clientId:表订单行]]" 这只是一个警告,但最好避免它们。

我遵循 Jasper de Vries 的建议

应该采取什么措施来绕过或解决需要定义惰性属性或不会导致 null 的 PrimeFaces 异常?

通过在UITable上设置全局属性lazy=true,如https://primefaces.github.io/primefaces/11_0_0/#/core/globalattributes

中所述
if (component instanceof UITable){
    component.getAttributes().put("lazy", true);
}

但现在我看到了除 UITable 之外的所有组件的警告

即使我将其设置在 if 块之外,这些多个警告也不会消失。

我应该返回到 PF 的早期版本吗?

任何提示表示赞赏,谢谢

jsf primefaces
1个回答
0
投票

其他组件也是

UITable
的实例。特别检查 PrimeFaces
DataTable

所以:

if (component instanceof DataTable) {
    ((DataTable) component).setLazy(true);
}
© www.soinside.com 2019 - 2024. All rights reserved.