在筑巢的另一个数据表中筑巢时,加载2个或更多的主行时,SplitButton停止工作
因此,我试图将数据嵌套嵌套在RowExpansion标签中的另一个数据表中,如下所示:
<h:form>
<p:dataTable var="item"
value="#{bean.items}">
<p:column>
<p:rowToggler/>
</p:column>
<p:column headerText="Item Name">
<h:outputText value="#{item.name}"/>
</p:column>
<p:rowExpansion>
<p:dataTable var="subitem"
value="#{item.subitems}">
<p:column headerText="Subitem Name">
<h:outputText value="#{subitem.name}" />
</p:column>
<p:column>
<p:splitButton value="Save" action="#{bean.save}">
<p:menuitem value="Update" action="#{bean.update}"/>
<p:menuitem value="Delete" action="#{bean.delete}"/>
</p:splitButton>
</p:column>
</p:dataTable>
</p:rowExpansion>
</p:dataTable>
</h:form>
BEAN中的测试方法只是
public void save() {
addMessage(FacesMessage.SEVERITY_INFO, "Success!", "Saved subitem");
PrimeFaces.current().ajax().update(":frmTopbar");
}
public void update() {
addMessage(FacesMessage.SEVERITY_INFO, "Success!", "Updated subitem");
PrimeFaces.current().ajax().update(":frmTopbar");
}
public void delete() {
addMessage(FacesMessage.SEVERITY_INFO, "Success!", "Deleted subitem");
PrimeFaces.current().ajax().update(":frmTopbar");
}
public void addMessage(FacesMessage.Severity severity, String summary, String detail) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, summary, detail));
}
仅一个项目及其子项目加载,所有内容都显示,并且SplitButton按钮正常工作。
Bean只是发送一个面孔进行测试,就像我说的那样,该消息适当地显示了3个按钮中的每个按钮。
但是,一旦我加载了2个或更多的项目及其子立法,一切在视觉上看起来都正确,但是SplitButton中的命令不再到达Bean,因此不会发送脸部。
是否有人知道发生了什么事或有关解决问题的建议?
我正在使用PrimeFaces v11.0
非常感谢!
So I'm trying to nest a datatable within another datatable in the rowexpansion tag as follows:
<h:form>
<p:dataTable var="item"
value="#{bean.items}">
<p:column>
<p:rowToggler/>
</p:column>
<p:column headerText="Item Name">
<h:outputText value="#{item.name}"/>
</p:column>
<p:rowExpansion>
<p:dataTable var="subitem"
value="#{item.subitems}">
<p:column headerText="Subitem Name">
<h:outputText value="#{subitem.name}" />
</p:column>
<p:column>
<p:splitButton value="Save" action="#{bean.save}">
<p:menuitem value="Update" action="#{bean.update}"/>
<p:menuitem value="Delete" action="#{bean.delete}"/>
</p:splitButton>
</p:column>
</p:dataTable>
</p:rowExpansion>
</p:dataTable>
</h:form>
the testing methods in the bean are just
public void save() {
addMessage(FacesMessage.SEVERITY_INFO, "Success!", "Saved subitem");
PrimeFaces.current().ajax().update(":frmTopbar");
}
public void update() {
addMessage(FacesMessage.SEVERITY_INFO, "Success!", "Updated subitem");
PrimeFaces.current().ajax().update(":frmTopbar");
}
public void delete() {
addMessage(FacesMessage.SEVERITY_INFO, "Success!", "Deleted subitem");
PrimeFaces.current().ajax().update(":frmTopbar");
}
public void addMessage(FacesMessage.Severity severity, String summary, String detail) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, summary, detail));
}
If only a single item and its subitems is loaded, everything displays and splitbutton buttons work fine.
The bean just sends a FacesMessage to test and like I said, the message is properly shown for each of the 3 buttons.
But as soon as I load 2 or more items and their subitems, everything looks visually correct, but the commands in splitbutton no longer reach bean, so no FacesMessage is sent.
Does anyone have a clue about what is going on or a suggestion as to what can be done to fix it?
I'm using primefaces v11.0
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我似乎使用Balusc的技巧找到了P:RemoteCommand的解决方法。
因此,我所做的就是将其放在我的页面中的某个地方,该页面将将JavaScript函数映射到BEAN方法。
然后,我将此jQuery代码放在我的页面中,以从任何拆分按钮中捕获点击事件:
现在,在我的bean函数中,我只是在以下操作中检索我的参数:
现在会做到的一个希望。
I seem to have found a workaround with p:remoteCommand using BalusC's tips.
So what I've done, is place this somewhere in my page that will map a javascript function to a bean method.
I then place this jquery code in my page to catch the click event from any split button:
Now in my bean function, I just retrieve my parameter as follows:
It'll do for now, although it would be nice if the components worked as one hopes.