[英]Rendering datatable column with ajax and jsf
I have a datatable listing some items with several details : 我有一个数据表,其中列出了一些具有一些详细信息的项目:
<h:dataTable id="versionInterfaces_datatable"
styleClass="datatable" rowClasses="odd,even"
value="#{versionToolManager.version.interfaces}"
var="lInterface">
<h:column>
<f:facet name="header">Interface Name</f:facet>
<h:commandLink id="versionInterfacesName_columnLink"
value="#{lInterface.name}"
action="#{interfaceManager.consult}">
<f:setPropertyActionListener
target="#{interfaceManager.interfaceEntity}"
value="#{lInterface}" />
</h:commandLink>
<h:outputText id="versionInterfacesName_column" value="#{lInterface.name}" />
</h:column>
<h:column id="interfaceVersions_column">
<f:facet name="header">Interface Version(s)</f:facet>
<ui:repeat value="#{lInterface.versionsInterface}" var="lVersionI"
varStatus="lStatus">
<h:outputText rendered="#{lVersionI.versionsTools.contains(versionToolManager.version)}" value=" #{lVersionI.name} | " />
</ui:repeat>
</h:column>
<h:column>
<f:facet name="header">Interface Description</f:facet>
<h:outputText id="versionInterfacesDescription_column"
value="#{lInterface.description}" />
</h:column>
and then I have a button calling a modal view allowing to add items : 然后我有一个按钮调用允许添加项目的模式视图:
<h:commandButton id="#{id}OpenModal_button"
value="#{openButtonValue}"
onclick="document.getElementById('#{formId}:#{modal_panel}').style.display='block'; return false;" />
<br />
when closing this modal view, I try to "refresh" the datatable to see the items added : 关闭此模式视图时,我尝试“刷新”数据表以查看添加的项目:
<h:commandButton id="#{id}CloseModal_button"
value="#{closeButtonValue}">
<f:ajax execute="@this"
render="#{renderOnClose} #{formId}:#{modal_panel}" />
</h:commandButton>
But the columns of my datatable are not all updated, the column "Interface Version(s)" is empty for the new lines corresponding to the new items even though when I save, they have been well added. 但是我的数据表中的列并未全部更新,即使与我保存时一样,与新项目相对应的新行的“接口版本”列也为空。
Do you have any idea ? 你有什么主意吗 ?
the problem is <f:ajax execute="@this" ...
问题是<f:ajax execute="@this" ...
use <f:ajax execute="@all" ...
使用<f:ajax execute="@all" ...
So I succeed to solve my problem but it wasn't a problem about the syntax but a bad use of the model and beans structure. 因此,我成功地解决了我的问题,但这不是语法问题,而是模型和bean结构的错误使用。 Without going into details, I was trying to reach data which weren't linked to the corresponding items. 在不赘述的情况下,我试图获取未链接到相应项目的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.