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.
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 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" >
开发者_C百科 <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. Also, in case it complicates things further, the page will also contain many <rich:dataTable />
's, each implementing this behavior.
Take a look at the <rich:componentControl />
tag.
Use attachTo to "bind" the event to display the modalPanel you wish to popup using the for attribute.
Ex:
<h:outputLink id="modalPanelLink" value="#">Show Details
<rich:componentControl attachTo="modalPanelLink" for="modalPanelId" event="onclick" operation="show" />
</h:outputLink>
精彩评论