【问题标题】:Display dialog from backing bean in primefaces mobile在primefaces mobile中显示来自backing bean的对话框
【发布时间】:2016-08-05 20:28:23
【问题描述】:

我正在使用 PF mobile 对我们的网站进行移动转换。我正在尝试使用 Primefaces mobile 在对话框中打开视图。它在桌面浏览器中工作得很好,但在移动版本中却不行。页面一直等待加载,但没有任何反应。它没有在 PF mobile 中实现还是我的代码有问题?

下面是视图-webapp/m/dlg/sampledlg.xhtml

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"xmlns:h="http://java.sun.com/jsf/html"xmlns:f="http://java.sun.com/jsf/core"xmlns:p="http://primefaces.org/ui"xmlns:pm="http://primefaces.org/mobile"><f:view renderKitId="PRIMEFACES_MOBILE" /><h:head></h:head><h:body><pm:page id="main"><pm:header title="Main Page">/pm:header><pm:content><p:link outcome="pm:second" value="Go" /></pm:content></pm:page><pm:page id="second" lazy="true"><pm:header title="Second Page"></pm:header><pm:content>Sample content</pm:content></pm:page></h:body></html>

以下是支持 bean 的代码。

RequestContext.getCurrentInstance().openDialog("dlg/sampledlg");
return;

类似以下仅显示消息的基本对话框在移动页面中也不起作用。但它适用于桌面。

RequestContext.getCurrentInstance().showMessageInDialog("This is sample text");

face-config.xml 有以下内容:

<navigation-handler>
     org.primefaces.application.DialogNavigationHandler
  </navigation-handler>

  <view-handler>org.primefaces.application.DialogViewHandler</view-handler>

  <navigation-handler>org.primefaces.mobile.application.MobileNavigationHandler</navigation-handler>

如果需要,我绝对可以添加更多信息。非常感谢这里的任何帮助。提前谢谢你。

这是我的平台信息: - 托梅 7.0.0 M3 - Primefaces 6.0 - JSF 2.2.12 - JDK 1.7 - 吉7

【问题讨论】:

  • 可以添加版本信息吗?
  • @Kukeltje 这是我的平台信息:Tomee 7.0.0 M3,Primefaces 6.0,Jsf 2.2.12,Jdk 1.7,Jee 7。我也更新了这个问题。感谢您的投入。谢谢。

标签: jquery-mobile mobile jsf-2 primefaces primefaces-mobile


【解决方案1】:

工作解决方案:

豆:

...
RequestContext.getCurrentInstance().execute("PF('dlgDelete').show();");

xhtml:

...
<p:dialog header="confirmation" widgetVar="dlgDelete" >
    <p:outputLabel value="Are you...?"/>
    <p:commandButton value="yes" action="#{appBean.deleteMethod()}" update="tblParts" oncomplete="PF('dlgDelete').hide();" icon="ui-icon-check" iconPos="right" styleClass="ui-btn-inline"/>
    <p:commandButton value="no" onclick="PF('dlgDelete').hide();" icon="ui-icon-forbidden" iconPos="right" styleClass="ui-btn-inline"/>
</p:dialog>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-10
    • 2021-12-12
    • 2018-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-15
    • 2013-06-28
    相关资源
    最近更新 更多