Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There's nothing like that in the standard JSF API. Also nothing comes to mind in PrimeFaces.</p> <p>The <a href="http://omnifaces.org" rel="nofollow noreferrer">OmniFaces</a> <a href="http://showcase.omnifaces.org/components/componentIdParam" rel="nofollow noreferrer"><code>&lt;o:componentIdParam&gt;</code></a> may however be exactly what you're looking for. It allows you to let JSF render only a subset of the component tree based on a specific request parameter, which can be a component ID or a client ID. You could basically just use jQuery's <a href="http://api.jquery.com/jQuery.get/" rel="nofollow noreferrer"><code>$.get()</code></a> to reload the <code>&lt;ui:repeat&gt;</code> along with the start index as a request parameter and use jQuery's <a href="http://api.jquery.com/append/" rel="nofollow noreferrer"><code>$.append()</code></a> to append it to the HTML DOM.</p> <p>Here's a complete kickoff example. The view:</p> <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:o="http://omnifaces.org/ui" &gt; &lt;f:metadata&gt; &lt;o:componentIdParam componentIdName="componentId" /&gt; &lt;/f:metadata&gt; &lt;h:head&gt; &lt;title&gt;Stack Overflow Question 11364006&lt;/title&gt; &lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt; &lt;!-- Substitute with PrimeFaces' one, if necessary. --&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;ul id="items"&gt; &lt;ui:repeat id="itemsRepeater" value="#{bean.items}" var="item"&gt; &lt;li&gt;#{item}&lt;/li&gt; &lt;/ui:repeat&gt; &lt;/ul&gt; &lt;input type="button" id="showMore" value="Show more"/&gt; &lt;h:outputScript&gt; $("#showMore").click(function() { $items = $("#items"); var params = { start: $items.find("li").length, componentId: "itemsRepeater" }; $.get(location, params, function(html) { $items.append(html); }); }); &lt;/h:outputScript&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre> <p>The backing bean:</p> <pre class="lang-java prettyprint-override"><code>@ManagedBean @RequestScoped public class Bean { private List&lt;String&gt; items; @ManagedProperty("#{param.start}") private int start; @PostConstruct public void init() { // Just a stub. Do your thing to fill the items. items = new ArrayList&lt;String&gt;(); int size = start + 10; for (int i = start; i &lt; size; i++) { items.add("item " + (i + 1)); } } public void setStart(int start) { this.start = start; } public List&lt;String&gt; getItems() { return items; } } </code></pre> <hr> <p><strong>Update</strong>: a live demo can be found in the "Expandable list" example of <a href="http://showcase.omnifaces.org/components/componentIdParam" rel="nofollow noreferrer">the <code>&lt;o:componentIdParam&gt;</code> page of current showcase application</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload