简体   繁体   English

为每个分配唯一的客户端ID <rich:dataTable /> 行?

[英]Assign a unique client ID to each <rich:dataTable /> row?

I'm relatively new to working with the UI in Seam, so I'm hoping there is something simple I can replace the three instances of UNIQUE_ID with in the following example. 我在Seam中使用UI相对较新,因此希望在以下示例中可以用一些简单的东西替换UNIQUE_ID的三个实例。

The goal is to have a <rich:dataTable /> wherein each row has the ability to show/hide a <rich:modalPanel /> with more details about the particular object instance. 目的是要有一个<rich:dataTable />其中每一行都可以显示/隐藏一个<rich:modalPanel />其中包含有关特定对象实例的更多详细信息。

<rich:dataTable var="object" value="#{bean.myObject}">
  <rich:column>
    <h:outputText value="#{object.summary}" />
  </rich:column>

  <rich:column>
    <a onclick="Richfaces.showModalPanel('UNIQUE_ID');" href="#">Show Details in ModalPanel</a>
    <a4j:form>
      <rich:modalPanel id="UNIQUE_ID" >
        <a onclick="Richfaces.hideModalPanel('UNIQUE_ID');" href="#">Hide This ModalPanel</a>
        <h:outputText value="#{object.details}" />
      </rich:modalPanel>
    </a4j:form>
  </rich:column>
</rich:dataTable>

If I only had one link/modalPanel pair, this would obviously be trivial, but I don't know what to do within the scope of the <rich:dataTable /> 's iteration. 如果我只有一对link / modalPanel对,这显然是微不足道的,但是我不知道在<rich:dataTable />的迭代范围内该怎么做。 Also, in case it complicates things further, the page will also contain many <rich:dataTable /> 's, each implementing this behavior. 同样,如果进一步使事情复杂化,该页面还将包含许多<rich:dataTable /> ,每个都实现此行为。

Take a look at the <rich:componentControl /> tag. 看一下<rich:componentControl />标记。

Use attachTo to "bind" the event to display the modalPanel you wish to popup using the for attribute. 使用attachTo来“绑定”事件,以使用for属性显示要弹出的modalPanel。

Ex: 例如:

<h:outputLink id="modalPanelLink" value="#">Show Details
    <rich:componentControl attachTo="modalPanelLink" for="modalPanelId" event="onclick" operation="show" />
</h:outputLink>

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

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