0
votes

I am looking at picking a date in Primefaces Mobile with "calendar" component: <p:calendar value="#{bean.date}" pattern="MM/dd/yyyy HH:mm" /> The calendar pops up but it looks very odd. It overlaps the page content in a transparent way.

Is there a work around for this issue? Or a way to get it pop up correctly inside a dialog? Maybe to combine another framework with Primefaces?

By the way, the dialog seems not to work too in Primefaces Mobile.

Thanks

1

1 Answers

0
votes

Primefaces Mobile is really great and is still under development but it doesn't implement Jquery mobile extensions like "datebox". I find a way to combine both. I included the jquery-datebox library in the header of a JSF page (see 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>

The datepicker works well but both sliders inside and outside a pm-view (see the code) are displayed like normal inputs!

Any suggestions? Thanks

PS: @administrator: a new tag is needed: "Primefaces-mobile"