【发布时间】:2015-09-06 04:11:07
【问题描述】:
我正在尝试删除数据表值。我的数据表显示了很多值。当我单击删除数据表中的特定行时,确认对话框打开。如果单击确定,则调用 bean 并将该值删除到数据库中。如果单击取消则不调用 bean.. 这是我的功能..
例如: 我的数据表显示 10 行。当我选择 1 行删除按钮单击调用 bean 但它获取另一行值传递给 bean...
我的用户界面代码..
<h:commandButton image="/images/remove.png" onclick="# {rich:component('confirmation')}.show();return false"/>
<a4j:jsFunction name="submit" action="#{bean.delete}">
<f:setPropertyActionListener target="#{bean.name}" value="#{info.name}" />
</a4j:jsFunction>
<rich:popupPanel id="confirmation" width="250" height="150">
<f:facet name="header">confirmation</f:facet>
<h:panelGrid>
<h:panelGrid columns="2">
<h:graphicImage value="/images/remove.png" />
<h:outputText value="Are you sure?" style="FONT-SIZE: large;" />
</h:panelGrid>
<br></br>
<h:panelGroup >
<center><input type="button" value="OK"
onclick="#{rich:component('confirmation')}.hide();submit();return false" />
<input type="button" value="Cancel"
onclick="#{rich:component('confirmation')}.hide();return false" /> </center>
</h:panelGroup>
</h:panelGrid>
</rich:popupPanel>
【问题讨论】:
-
你有什么问题?
-
将错误的值传递给 bean -
jsFunction是在dataTable里面还是外面? (我假设“info”是表中的一个变量)
-
最有可能的 2 个操作是我们同步的:删除“当前”行并激活选定行。您可以使用 at 代码发布表格吗?