2012-12-03 45 views
0

我正在使用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> 

現在發生了什麼的代碼創建動態鏈接的列表,如果我點擊這些鏈接將會打開遠程dialog.But問題是第一行鏈接無法使用相應的內容,但所有的其他鏈接正常工作,並打開相應的對話框。對於第一個鏈接,甚至沒有打開對話框。 誤差其Java腳本的控制檯顯示的是:

無法設置的不確定

回答

1

要指定同一個ID多個元素屬性「href」屬性,即is against (X)HTML specs,並且不允許你在以後唯一地引用一個元素(使用相同的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> 

的參數多像這樣的東西ID