![](/img/trans.png)
[英]I need to assign a random but unique ID to each row of mysql table.The ID should be same if the row contains same values
[英]Assign a unique client ID to each <rich:dataTable /> row?
我在Seam中使用UI相對較新,因此希望在以下示例中可以用一些簡單的東西替換UNIQUE_ID
的三個實例。
目的是要有一個<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>
如果我只有一對link / modalPanel對,這顯然是微不足道的,但是我不知道在<rich:dataTable />
的迭代范圍內該怎么做。 同樣,如果進一步使事情復雜化,該頁面還將包含許多<rich:dataTable />
,每個都實現此行為。
看一下<rich:componentControl />
標記。
使用attachTo來“綁定”事件,以使用for屬性顯示要彈出的modalPanel。
例如:
<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.