[英]Unable to load the remote dialog of Struts2-Jquery
我正在使用Struts2 Jquery插件,請看一下這段代碼。
<s:iterator status="stat" value="primeDisplayLocationBeans">
<tr>
<td class="last center">
<sj:a openDialog="myremotedialog" href="opendemographicdetails?locationId=%{id}">
Demographic
</sj:a>
<sj:dialog id="myremotedialog" autoOpen="false"
title="Demographic Details" width="800"/>
</td>
</tr>
</s:iterator>
現在發生了什么代碼創建了一個動態鏈接列表,如果我單擊這些鏈接,它將打開遠程對話框上的相應內容。但是問題是第一行鏈接無法正常工作,但是所有其他鏈接都可以正常工作並打開對於第一個鏈接,甚至沒有打開對話框。 它在Java腳本控制台中顯示的錯誤是:
無法設置未定義的屬性“ href”
您正在將相同的ID分配給多個元素,這違反(X)HTML規范 ,並且不允許您以后唯一地引用一個元素(多個元素具有相同的ID)。
使用以下參數對您的ID進行參數化:
<s:iterator status="stat" value="primeDisplayLocationBeans">
<tr>
<td class="last center">
<sj:a openDialog="myremotedialog_%{#stat.index}"
href="opendemographicdetails?locationId=%{id}">Demographic</sj:a>
<sj:dialog id="myremotedialog_%{#stat.index}"
autoOpen="false" title="Demographic Details" width="800"/>
</td>
</tr>
</s:iterator>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.