【问题标题】:f:ajax does not update t:dataTable on completef:ajax 不更新 t:dataTable 完成
【发布时间】:2012-09-19 03:58:09
【问题描述】:

我有一个 JSF 搜索命令按钮和一个显示搜索结果的战斧数据表。单击命令按钮时,数据表应输出搜索结果。无论如何,因为我使用 JSF Ajax,所以 dataTable 没有显示。我只是想知道 JSF Ajax 是否会导致问题?

这是导致表格现在呈现的有问题的代码:

<h:commandButton id="search" value="#{msg.Label_Search}" action="#{theBean.doSearch}">
  <f:ajax render="searchStatus" execute="@form" />
</h:commandButton>
<h:outputText id="searchStatus" value="Loading data now..." rendered="#{theBean.searchingNow}" />

<h:panelGroup id="searchResultTable">
  <t:dataTable ... />
</h:panelGroup>

*注意这一点。如果 ajax 代码被删除。它工作正常。

【问题讨论】:

    标签: ajax jsf facelets myfaces tomahawk


    【解决方案1】:

    当 ajax 请求完成时,您只是在更新 searchStatus,而不是 searchResultTable。因此,最终用户确实永远不会看到searchResultTable 的 HTML 表示形式的视觉变化。

    相应地修复&lt;f:ajax render&gt;,以便searchResultTable也真正更新:

    <f:ajax render="searchStatus searchResultTable" execute="@form" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-23
      • 1970-01-01
      • 2012-02-04
      • 1970-01-01
      • 2013-03-25
      • 2019-06-11
      • 1970-01-01
      相关资源
      最近更新 更多