01-12-2020 09:36 AM
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!
01-12-2020 01:06 PM
Hello,
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.docum...
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:
<require>org.nuxeo.ecm.document.pageproviders</require>
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">
<require>org.nuxeo.ecm.document.pageproviders</require>
<extension target="org.nuxeo.ecm.platform.query.api.PageProviderService" point="providers">
<coreQueryPageProvider name="advanced_document_content">
<trackUsage>true</trackUsage>
<property name="maxResults">DEFAULT_NAVIGATION_RESULTS</property>
<whereClause docType="AdvancedContent">
<fixedPart>
ecm:isVersion = 0 AND ecm:mixinType != 'HiddenInNavigation'
</fixedPart>
<predicate operator="FULLTEXT" parameter="dc:title">
<field name="title" schema="advanced_content"/>
</predicate>
<predicate operator="=" parameter="ecm:parentId">
<field name="ecm_parentId" schema="advanced_content"/>
</predicate>
<predicate operator="=" parameter="ecm:isTrashed">
<field name="ecm_trashed" schema="advanced_content"/>
</predicate>
</whereClause>
<aggregates>
<aggregate id="dc_last_contributor_agg" parameter="dc:lastContributor" type="terms">
<field name="dc_last_contributor_agg" schema="advanced_content"/>
<properties>
<property name="size">10</property>
</properties>
</aggregate>
<aggregate id="dc_modified_agg" parameter="dc:modified" type="date_range">
<field name="dc_modified_agg" schema="advanced_content"/>
<properties>
<property name="format">"dd-MM-yyyy"</property>
</properties>
<dateRanges>
<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"/>
</dateRanges>
</aggregate>
</aggregates>
<sort ascending="true" column="dc:title"/>
<pageSize>20</pageSize>
</coreQueryPageProvider>
</extension>
</component>
01-12-2020 01:06 PM
Hello,
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.docum...
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:
<require>org.nuxeo.ecm.document.pageproviders</require>
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">
<require>org.nuxeo.ecm.document.pageproviders</require>
<extension target="org.nuxeo.ecm.platform.query.api.PageProviderService" point="providers">
<coreQueryPageProvider name="advanced_document_content">
<trackUsage>true</trackUsage>
<property name="maxResults">DEFAULT_NAVIGATION_RESULTS</property>
<whereClause docType="AdvancedContent">
<fixedPart>
ecm:isVersion = 0 AND ecm:mixinType != 'HiddenInNavigation'
</fixedPart>
<predicate operator="FULLTEXT" parameter="dc:title">
<field name="title" schema="advanced_content"/>
</predicate>
<predicate operator="=" parameter="ecm:parentId">
<field name="ecm_parentId" schema="advanced_content"/>
</predicate>
<predicate operator="=" parameter="ecm:isTrashed">
<field name="ecm_trashed" schema="advanced_content"/>
</predicate>
</whereClause>
<aggregates>
<aggregate id="dc_last_contributor_agg" parameter="dc:lastContributor" type="terms">
<field name="dc_last_contributor_agg" schema="advanced_content"/>
<properties>
<property name="size">10</property>
</properties>
</aggregate>
<aggregate id="dc_modified_agg" parameter="dc:modified" type="date_range">
<field name="dc_modified_agg" schema="advanced_content"/>
<properties>
<property name="format">"dd-MM-yyyy"</property>
</properties>
<dateRanges>
<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"/>
</dateRanges>
</aggregate>
</aggregates>
<sort ascending="true" column="dc:title"/>
<pageSize>20</pageSize>
</coreQueryPageProvider>
</extension>
</component>
01-28-2020 06:33 AM
Thank you [Rodri ](https
01-21-2020 11:32 AM
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
01-28-2020 06:37 AM
Thanks, [Jackie A](https
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.