1

I'm using Primefaces mobile and I've created a dataList to display my database information. But I need to make it so that it has liveScroll, meaning, I can keep scrolling down and once I hit a certain number of records displayed (I've set it to 3 here) a button should appear saying "More Results" that would load more results. I know it's possible, I've seen it here:http://forum.primefaces.org/viewtopic.php?f=8&t=30479&p=98383#p98383

But for me it's not working, it just displays the full dataList with all the database records instead of just showing 3 at a time like I set it to.

<p:dataList id="dataList" value="#{search.dbRecord}" var="record" paginator="true" rows="3" >
             <f:attribute name="paginatorText" value="More Results" />
             <p:column>
             <h:outputLink value="#">

                 <h2>#{record.name}</h2>
                 <h2>#{record.number}</h2>

             </h:outputLink>
             </p:column>
</p:dataList>

What am I doing wrong?

EDIT: Turns out this functionality is still not working in Primefaces 5.0 so I used Primefaces mobile 0.9.4

sparrow.
  • 101
  • 8

1 Answers1

0

which version of PrimeFaces are you using ?

Edit :

PrimeFaces Mobile 0.9.4

Download with Maven :

Group id of the dependency is org.primefaces and artifact id is primefaces-mobile:

<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces-mobile</artifactId>
<version>0.9.4</version>
</dependency>

In addition to the configuration above you also need to add PrimeFaces maven repository to the repository list so that maven can download it :

 <repository>
    <id>prime-repo</id>
    <name>Prime Repo</name>
    <url>http://repository.primefaces.org</url>
    </repository>
  • I'm using primefaces 5.0 – sparrow. Jul 19 '14 at 22:10
  • 1
    I think, it does not work for the latest version of PrimeFaces, PFM paginator it's not even documented in PF guide 5.0, check this example, i think it's work for previous version : https://code.google.com/p/primefaces/source/browse/examples/trunk/showcase/src/main/webapp/mobile/lists.xhtml?r=9215 –  Jul 20 '14 at 01:52
  • oh, I see. It's weird that it works in previous versions but not in the latest one. Can you link me to a place where I can download that version of primefaces ? – sparrow. Jul 20 '14 at 13:50
  • 1
    I modified my answer above, you can download the previous version with Maven –  Jul 20 '14 at 15:12
  • After adding the dependency and adding the primefaces repository, netbeans can't even run the project. It says "The module has not been deployed" and on the glassfish server logs it shows the following error: `Source Document: jar:file:/C:/Users/sparrow/Documents/nbProjects/JSFTest/build/web/WEB-INF/lib/primefaces-mobile-0.9.5.jar!/META-INF/faces-config.xml Cause: Class 'org.primefaces.mobile.renderkit.CommandButtonRenderer' is missing a runtime dependency: java.lang.NoClassDefFoundError:org/primefaces/renderkit/CoreRenderer` – sparrow. Jul 21 '14 at 06:02
  • 1
    Have you define in faces-config.xml the renderKit ? if not add this in your faces-config.xml, PRIMEFACES_MOBILE –  Jul 21 '14 at 08:19
  • try use the version 1.0.0 and tell me what you got, org.primefaces primefaces-mobile 1.0.0-SNAPSHOT –  Jul 21 '14 at 10:02
  • 1
    and not forget to remove PrimeFaces 5.0 from the pom.xml –  Jul 21 '14 at 10:04
  • I still get the same error. Before this line: `Source Document: jar:file:/C:/Users/sparrow/Documents/nbProjects/JSFTest/build/web/WEB-INF/lib/primefaces-mobile-1.0.0-SNAPSHOT.jar!/META-INF/faces-config.xml` there is this error in red: `SEVERE: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: ` This line apeared with the previous version I tried too, I just didn't mention it because I thought it wouldn't matter. – sparrow. Jul 21 '14 at 10:32
  • I don't understand, on the error it says the source document that has the error is the faces-config.xml file inside the .jar file. – sparrow. Jul 21 '14 at 10:34
  • I created a new project to test this, so my faces-config.xml is mostly empty. The content of my faces-config.xml file is just 1 line: ` PRIMEFACES_MOBILE ` – sparrow. Jul 21 '14 at 10:55
  • 1
    just to verify, so your faces-config.xml is like this ? : PRIMEFACES_MOBILE –  Jul 21 '14 at 11:02
  • My faces-config.xml file was created by Netbeans automatically, so it's slightly different. Here is a screenshot: http://i.imgur.com/CZ3wxWs.png I tried that one you just posted but I get an error: `Unable to parse document 'jndi:/server/JSFTest/WEB-INF/faces-config.xml': null` – sparrow. Jul 21 '14 at 12:16
  • 1
    you need also to add the dependency of PrimeFaces Core : org.primefaces primefaces 4.0 –  Jul 21 '14 at 12:48
  • Thank you, after adding that to the pom.xml file, it worked. The dataList is now working too, just had to use version 0.9.4. – sparrow. Jul 21 '14 at 13:03