2013-02-11 52 views
0

以下在primefaces 3.0中工作的代码在3.5中不起作用。Primefaces 3.0到3.5对话框不起作用

错误:dialog()不存在于javascript我的查询是对话框已从dialog.js中删除?如果是的话,那么什么是替代?

function OpenDialog(currentDialog, commandSource) { 
    $(currentDialog).dialog('open'); 
    var myDialogX = jQuery(commandSource).offset().left + 10; 
    var myDialogY = (jQuery(commandSource).offset().top - jQuery(document).scrollTop()) + 30; 
    //jQuery(currentDialog).dialog('option', 'position', [ myDialogX, myDialogY ]); 
} 


    <p:commandLink id="treedialog-copy" 
     title="title" value="Copy tree" 
     oncomplete="OpenDialog('#copyTree','#treedialog-copy')" /> 



    <p:outputPanel id="TreePanel"> 
     <p:dialog id="copyTree" header="Tree Dialog" 
      styleClass="dlgAssignTree" modal="false" width="600" height="250" widgetVar="copyTrees"> 
      <h:form id="copyTreeForm"> 
       <p:outputPanel id="TreePanel"> 
        <p:tree id="component2" 
         value="#{bean.provideTreeRootNode}" var="_node" 
         dynamic="true" cache="false" selectionMode="multiple" 
         selection="#{bean.selectedCopyNodes}"> 
         <p:ajax event="select" 
          listener="#{bean.onNodeSelectCopy}" /> 
         <p:ajax event="unselect" 
          listener="#{processBean.onNodeUnSelectCopy}" /> 
         <p:treeNode> 
          <h:outputText value="#{_node.name}" /> 
         </p:treeNode> 
        </p:tree> 
       </p:outputPanel> 
      </h:form> 
     </p:dialog> 
    </p:outputPanel> 
+0

通过查看页面的源代码,检查生成的''和''组件的HTML标识符,我敢打赌它们不是'copyTree'和' treedialog-copy'。使用Firebug或Chrome控制台等JavaScript控制台是明智的做法。另外,请确保你的''在''之外,它包含你的'' – 2013-02-11 04:37:31

回答

1

我觉得你可以直接箱子一个对话框,这样的事情..

<p:commandButton id="basic" value="Basic" onclick="dlg1.show();" type="button" /> 
    <p:dialog id="basicDialog" header="Basic Dialog" widgetVar="dlg1"> 
     <h:outputText value="Resistance to PrimeFaces is futile!" /> 
    </p:dialog> 

如果您正在使用Primefaces然后我没有的东西,我们必须创建一个对话框中手动,我们可以用自己的组件它会增加生产力和bug修复时间