0
我想在我的gsp的不同id上觸發相同的對話框。 所以這裏是代碼:在標籤屬性中使用scriptlet或EL(Grails UI Plugin)
<div class="yui3-widget-bd">
<g:each in="deployments" status="index" var="workflow">
<% def id = "reloadFile"+index %>
<gui:dialog title="Reload File" form="true" modal="true"
controller="admin" action="reloadFile"
triggers="[show:[id:'${id}', on:'click']]">
<p>To reload the file, please...</p><br />
<input type="file" id="deploymentFile" name="deploymentFile" />
</gui:dialog>
</g:each>
</div>
的問題是scriptlet代碼:
triggers="[show:[id:'<%=id %>', on:'click']]"
是沒有得到評估。 偵聽在生成的HTML源事件中的JavaScript看起來像這樣:
YAHOO.util.Event.addListener("${id}", "click", GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce.show, GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce, true);
所以,我怎麼能管理,源看起來像這樣? :
YAHOO.util.Event.addListener("reloadFile1", "click", GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce.show, GRAILSUI.gui_e0100d149e0a7b531017e0decaee9fce, true);
謝謝。
除去$ {id}周圍的單引號怎麼辦? (triggers =「[show:[id:$ {id},on:'click']]」) – Todd 2012-04-26 12:46:37
謝謝你的回答託德,但那不起作用。我得到一個GrailsTagException。還有什麼想法? – Paul 2012-04-27 01:16:48