【问题标题】:calendar in Primefaces MobilePrimefaces Mobile 中的日历
【发布时间】:2011-09-14 15:20:00
【问题描述】:

我正在考虑使用“日历”组件在 Primefaces Mobile 中选择日期: <p:calendar value="#{bean.date}" pattern="MM/dd/yyyy HH:mm" /> 日历弹出,但看起来很奇怪。它以透明的方式覆盖页面内容。

是否有解决此问题的方法?或者一种让它在对话框中正确弹出的方法?也许将另一个框架与 Primefaces 结合起来?

顺便说一句,该对话框在 Primefaces Mobile 中似乎也不起作用。

谢谢

【问题讨论】:

    标签: mobile jsf-2 calendar primefaces


    【解决方案1】:

    Primefaces Mobile 非常棒,并且仍在开发中,但它没有实现像“datebox”这样的 Jquery 移动扩展。我找到了一种将两者结合起来的方法。我在 JSF 页面的标题中包含了 jquery-datebox 库(请参阅link):

    <f:view xmlns="http://www.w3.org/1999/xhtml"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:pm="http://primefaces.prime.com.tr/mobile"
            xmlns:p="http://primefaces.prime.com.tr/ui"
            contentType="text/html">
    
        <pm:page title="Faces">
    
            <f:facet name="postinit">            
                <h:outputStylesheet library="css" name="jquery.mobile-1.0b3.min.css" />
                <h:outputStylesheet library="css" name="jquery.mobile.datebox.min.css" />            
                <h:outputScript library="primefaces" name="mobile/mobile.js" />
                <h:outputScript library="js" name="jquery.mobile.datebox.min.js" />
            </f:facet>
    
            <!-- Main View -->
            <pm:view id="main" swatch="b">
                 <pm:header title="Hello">
                    <f:facet name="left">
                        <pm:button value="Back" icon="back" role="back"/>
                    </f:facet>
                </pm:header>
    
                <pm:content>
                    <h:form id="myform">
                        <h:outputText value="Input: " />
                        <h:inputText id="input" />                    
                    </h:form>                
                </pm:content>
    
                <label for="mydate">Date: </label>                                                                           
                <input name="mydate" id="mydate" type="date" data-role="datebox" value="#{mybean.date}" 
                       data-options='{"mode": "calbox"}' />
    
                <div data-role="fieldcontain">
                        <label for="slider">Duration: </label>
                        <input type="range" name="slider" id="slider" 
                               value="#{mybean.duration}" min="1" max="10"  />
                </div>
    
                <pm:content>
                    <h:form id="Form">
                   <pm:field>
                        <h:outputLabel for="duration" value="duration: "/>
                        <pm:slider id="duration" min="1" max="10" value="#{mybean.duration}"/>
                    </pm:field>
                  </h:form>  
                </pm:content>
    
            </pm:view>
         </pm:page>
    
    </f:view>
    

    日期选择器运行良好,但 pm-view 内部和外部的滑块(参见代码)都像正常输入一样显示!

    有什么建议吗?谢谢

    PS:@administrator:需要一个新标签:“Primefaces-mobile”

    【讨论】:

      猜你喜欢
      • 2013-06-09
      • 1970-01-01
      • 2013-02-22
      • 2012-09-27
      • 1970-01-01
      • 1970-01-01
      • 2014-12-18
      • 1970-01-01
      • 2016-03-22
      相关资源
      最近更新 更多