2012-07-22 84 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

相关问题