Paging in vocabulary editor?

Is it possible to do paging in the vocabulary editor?

For one client, the vocabulary is huge and sometimes create a timeout (firefox) while loading.

Is there a way to define the vocabulary so there is paging in the editor?

Thanks,

Patrick

0 votes

2 answers

1082 views

ANSWER



For very large vocabulary I had success by replacing the nxu repeat in view_directory.xhtml template with an a4j:repeat and rich:datascroller like follows. I does not makes database query faster, but should shorten considerably page loading time and works well for ~2000 entries vocabularies.

<a4j:form rendered="#{!empty directoryUIActions.currentDirectoryEntries}"
          id="viewDirectoryEntries">

  <rich:datascroller align="center" for="directoryData"
                     reRender="viewDirectoryEntries"
                     renderIfSinglePage="false" />
  <table class="dataOutput">
    <tbody>
      <a4j:repeat id="directoryData" rows="10" var="entry" rowKeyVar="index"
                  value="#{directoryUIActions.currentDirectoryEntries}">
        <nxl:layout name="#{currentVoc.layout}" mode="view_list"
                    value="#{entry}" />
      </a4j:repeat>
    </tbody>
  </table>
  <rich:datascroller align="center" for="directoryData"
                     reRender="viewDirectoryEntries"
                     renderIfSinglePage="false" />

</a4j:form>
1 votes



Thanks this is interesting waiting the clean implementation.
09/03/2012

Ask and you shall receive. Implementing contrib on github https://github.com/simpoir/nuxeo-pagedvocab.git

Cheers!

09/04/2012


Hi,

There's currently no easy way to do that as directory API does not currently support pagination, see NXP-5301.

And the page displaying directory entries is not optimized: it was the first one designed to use layouts for listings, and it would need an upgrade to rely on content views.

But you could gain something (maybe enough) by overriding the template at /directory/view_directory.xhtml to implement pseudo-pagination for big vocabularies, at least at the UI level: the rendered HTML page would be lighter. Especially the nxu:repeat tag can be costly, and it should not be needed anymore for layouts rendering (using a c:forEach tag should be enough).

0 votes



I noted the patch for NXP-9668, that replaces nxu:repeat by c:forEach.

When I applied it and restarted, accessing the page for vocabularies led to an OutOfMemoryError in ForEachHandler. (As an aside, it should be noted that the instance in question has about 3700 entries in the aforementioned vocabulary.)

Here is a relevant stack trace excerpt :

Caused by: java.lang.OutOfMemoryError: Java heap space

at com.sun.facelets.tag.jstl.core.ForEachHandler.apply(ForEachHandler.java:123)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at org.nuxeo.ecm.platform.ui.web.binding.alias.AliasTagHandler.apply(AliasTagHandler.java:152)
at org.nuxeo.ecm.platform.ui.web.tag.handler.SetTagHandler.apply(SetTagHandler.java:116)
at org.nuxeo.ecm.platform.ui.web.binding.alias.AliasTagHandler.apply(AliasTagHandler.java:152)
at org.nuxeo.ecm.platform.ui.web.tag.handler.SetTagHandler.apply(SetTagHandler.java:116)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFacelet.include(DefaultFacelet.java:256)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFacelet.include(DefaultFacelet.java:306)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFacelet.include(DefaultFacelet.java:280)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:169)
at com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:65)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
at com.sun.facelets.tag.jstl.core.IfHandler.apply(IfHandler.java:54)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFacelet.include(DefaultFacelet.java:256)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFacelet.include(DefaultFacelet.java:306)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFacelet.include(DefaultFacelet.java:280)
at org.nuxeo.theme.jsf.facelets.vendor.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:169)
at com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:65)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
08/28/2012