WEB UI: How to sort items in the table view by Title

Hi! In the drawer the browser elements are sorted by Title by default. However, in the main container, using table view there is no sorting options (as in the grid view) and it seems that they appear by the date modified in reverse order (from newest to oldest). Where and what I would contribute (without Studio) to make the columns sortable, or at least sort the rows the same way as in the drawer? Thanks in advance!

type an image title

0 votes

2 answers




I think there are several ways of achieving it, and one of them could be overriding the page provider used to retrieve the documents inside a folder. If you check the Web UI request while loading the page, you will see the page provider used is advanced_document_content.

So you only need to override it. Information about the page provider: https://explorer.nuxeo.com/nuxeo/site/distribution/server-10.10/viewContribution/org.nuxeo.ecm.document.pageproviders–providers

You need to scroll to the “advanced_document_content” page provider definition and copy it in your own contribution. As you can see, there is a property called “sort” at the end, property that you have to modify like follows:

<sort ascending="true" column="dc:title"/>

You also need to remember that you are overriding an existing page provider, so you need to include the following requirement to your component in order to be sure it will be loaded after the default page providers are loaded:


I have tested this solution and it worked as expected. Below you can find the full code. Hope it helps!

Full code:

<component name="org.nuxeo.ecm.document.pageproviders.override">

    <extension target="org.nuxeo.ecm.platform.query.api.PageProviderService" point="providers">
        <coreQueryPageProvider name="advanced_document_content">
            <property name="maxResults">DEFAULT_NAVIGATION_RESULTS</property>
            <whereClause docType="AdvancedContent">
                    ecm:isVersion = 0 AND ecm:mixinType != 'HiddenInNavigation'
                <predicate operator="FULLTEXT" parameter="dc:title">
                    <field name="title" schema="advanced_content"/>
                <predicate operator="=" parameter="ecm:parentId">
                    <field name="ecm_parentId" schema="advanced_content"/>
                <predicate operator="=" parameter="ecm:isTrashed">
                    <field name="ecm_trashed" schema="advanced_content"/>
                <aggregate id="dc_last_contributor_agg" parameter="dc:lastContributor" type="terms">
                    <field name="dc_last_contributor_agg" schema="advanced_content"/>
                        <property name="size">10</property>
                <aggregate id="dc_modified_agg" parameter="dc:modified" type="date_range">
                    <field name="dc_modified_agg" schema="advanced_content"/>
                        <property name="format">"dd-MM-yyyy"</property>
                        <dateRange fromDate="now-24H" key="last24h" toDate="now"/>
                        <dateRange fromDate="now-7d" key="lastWeek" toDate="now-24H"/>
                        <dateRange fromDate="now-1M" key="lastMonth" toDate="now-7d"/>
                        <dateRange fromDate="now-1y" key="lastYear" toDate="now-1M"/>
                        <dateRange key="priorToLastYear" toDate="now-1y"/>
            <sort ascending="true" column="dc:title"/>
2 votes

Thank you Rodri ! Very useful!

nuxeo-data-table-column has a sortBy attribute that could be used. Please see here: https://www.webcomponents.org/element/nuxeo/nuxeo-ui-elements/elements/nuxeo-data-table-column

1 votes

Thanks, Jackie A! Not tested yet, I was out of order for a while.