我的要求与“
primefaces close dialog on init don't work“但唯一的答案不是一个有效的解决方案,因为在Dialog Framework中我没有widgetVar
。
我的@PostConstruct
方法看起来很相似:
@PostConstruct
private void init() {
Tree tree = initTree();
if (tree.getChildCount() == 1) {
// @todo close dialog if tree has only 1 child
// this does not close the dialog
RequestContext.getCurrentInstance().closeDialog(true);
// this does not work, because there is no widgetVar
//RequestContext.getCurrentInstance().execute("yourDialogWidgetVar.close()");
}
}
那么,如何从@PostConstruct
方法关闭DialogFramework xhtml页面呢?
我在Wildfly 10.0.0.Final上使用Primefaces 6.0