2012-07-22 82 views
0

爲這個問題道歉,但我在JavaScript中的知識非常少。如何將spin.js添加到對話框

用戶按下按鈕後會彈出一個對話框,所以我想將spin.js添加到對話框中。

對話框JSF文件:

<script type="text/javascript"> 
    function showStatus() { 
     document.body.style.cursor = 'wait'; 
     statusDialog.show(); 
    } 

    function hideStatus() { 
     document.body.style.cursor = 'default'; 
     statusDialog.hide(); 
    } 
</script> 


<p:commandButton id="genButton" 
     value="Generate Files" 
     widgetVar="startButton1" 
     disabled="#{נean.disableButton}" 
     actionListener="#{bean.generateUdm}" 
     onclick="PrimeFaces.monitorDownload(showStatus, hideStatus)" 
     ajax="false" 
     style="width:200px" 
     icon="ui-icon-shuffle"> 
    <p:fileDownload value="#{bean.streamedContent}"/> 
</p:commandButton> 


<p:dialog modal="true" header="Generating fILE" showHeader="true" 
     position="center" 
     widgetVar="statusDialog" 
     draggable="false" 
     closable="false" 
     resizable="false"> 

     ????????????? ADD SPIN ??????????? 
</p:dialog> 

我設法自旋添加到我的web應用程序而不是經由對話。

我希望得到一些代碼示例。

+0

你在js控制檯中看到任何錯誤嗎? – Daniel 2012-07-22 06:20:58

回答

-1

如果所有你想要的是添加加載圖像對話框你爲什麼不把一個簡單的gif(can get one from google或生成一個由你的自我Ajaxload - Ajax loading gif generator

和使用簡單的<h:graphicImage表現出來......

JSF 2 GraphicImage Example

+0

,因爲它不能通過IE 8工作 – angus 2012-07-22 13:37:27

+0

不知道,你在評論中有什麼意思,但是嘗試在你的對話框中添加appendToBody =「true」 – Daniel 2012-07-22 19:04:43

+0

你建議的解決方案只適用於FireFox和Google Chrome,而我我沒有使用ajax(請參閱附加代碼) – angus 2012-07-22 21:43:11

相關問題