简体   繁体   English

在JSF中自刷新的组件

[英]component to self refresh in JSF

I am creating a table component using JSF and html table (no other faces table involved), so collection is taken as parameter and it iterates and display the table contents. 我正在使用JSF和html表创建一个表组件(没有涉及其他face表),因此collection被作为参数,它迭代并显示表内容。

I have a "Remove" link on click of which it should remove the items and it's working fine. 我有一个“删除”链接点击它应该删除项目,它工作正常。 My problem now is after the item is removed I need to self-refresh the table component. 我现在的问题是删除项后我需要自动刷新表组件。

It worked when I used @form in the render. 当我在渲染中使用@form时它起作用了。 But that would be an issue when integrating the component with any page. 但是,在将组件与任何页面集成时,这将是一个问题。 Anyone has ideas to self-refresh the table component on click of the "Remove" link? 有人想点击“删除”链接自行刷新表组件吗? Please provide your thoughts. 请提供您的想法。

      <a4j:commandLink id="removeSelection" actionListener="#{cc.attrs.rowRemoveEventListener}" render="@form #{cc.attrs.renderOnRemove}" styleClass="st-remove-link" onclick="">
        <f:param name="rowKey" value="#{rowKey}"/>
        <span class="link-text">Remove</span>
        <a4j:ajax event="click" render="#{cc.clientId}" />
      </a4j:commandLink> 

The full component markup: 完整的组件标记:

    <div id="#{cc.clientId}">
      <--stylesheet link here-->
      <h:panelGroup id="simpletablepanel" layout="block">
        <a4j:outputPanel id="simpletablebody" layout="block">
        <table>
          <tr>
            <td>
               <span>value</span>
            </td>
            <td>
              <a4j:commandLink id="removeSelection"
                actionListener="#{cc.attrs.rowRemoveEventListener}"
                render=":#{cc.clientId} #{cc.attrs.renderOnRemove}">
                  <f:param name="rowKey" value="#{rowKey}"/>
                  <span>Remove</span>
              </a4j:commandLink>
            </td>
          </tr>
        </tbody>
      </ui:fragment>
    </table>
  </a4j:outputPanel>
</div>

just check the below link, i hope you will found something.. 只需查看以下链接,我希望你能找到一些东西..

In JSF 2 - Trying to rerender a panelgroup that is between 2 ui:repeats 在JSF 2中 - 尝试重新呈现介于2 ui:重复之间的面板组

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM