cancel
Showing results for 
Search instead for 
Did you mean: 

Nuxeo Data Table View and Filtering

Sudarshan_Ghate
Confirmed Champ
Confirmed Champ
I have a folderish object called EmployeeData.  This contains multiple Employees which is basically a DocumentType.  Employees have properties such as EmployeeID, First Name, Last Name etc.  When I view the EmployeeData, I can see all the Employees.  For the EmployeeData content view, I want to be able to filter the data based on first name, last name etc.
None of the values I have typed in seem to work.  Can someone assist with the filter-by clause and what additional things I should be doing?
Here is the code fragment.
 
<nuxeo-data-table-column name="First Name" id="FirstName" field="employee:FirstName" sort-by="employee:FirstName" filter-by="employee:FirstName">
          <template>
            [[item.properties.employee:FirstName]]
          </template>
        </nuxeo-data-table-column>
 
Thank you ,
SG
7 REPLIES 7

Josh-F-Hyland
Employee
Employee

"filter-by" needs to contain the id of the predicate or aggregate that you're using for the filtering (as defined in your page provider).

EDIT: There's an example in the source, can't find one in the doc unfortunately:

https://github.com/nuxeo/nuxeo-ui-elements/blob/42b70790cc2d72355189f60ea6ce9cbff68e5d4e/nuxeo-data-...

--
Hyland Sales Solution Engineer

In the Studio Designer, it seems to be using [[nxProvider]] but clearly this must be a build in PP because I cannot find the definition for it.  When I trace the traffic it seems to be calling the "advanced_document_content" .  Is there a way to customize it using the following in the XML Extensions of Nuxeo Studio?

<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>
<predicate operator="STARTSWITH" parameter="employee:FirstName">
<field name="FirstName" schema="advanced_content"/>
</predicate>

 

Thank you

SG

Yes "advanced_document_content" is an OOTB page provider. Yes you can override any OOTB page provider, whether via XML contrib or just creating a PP in Studio with the same ID (which is effectively the same thing, in the end it's an XML contrib). I'd recommend making a PP of your own though, it will have fewer side effects. The "advanced_document_content" PP is used throughout WebUI so you need to be careful  when modifying it.

In general whenever I create a custom Folderish document type I will also create a matching page provider, as inevitably I will need to customize the viewing of its contents.

--
Hyland Sales Solution Engineer

Thank you.  So if the Folderish object is "Invoices", I should create a PP for it and use the PP in the View layout? 

The PP should specify the predicates and aggregates from contained objects?

Thanks,

SG

Yes exactly.

--
Hyland Sales Solution Engineer

Thank you.  In the NXQL query, how do I pass the current folders id?  Also I am trying to find documentation on how the following should be set.  Can you point me in the right direction?

Sudarshan_Ghate_0-1741706044237.png

Thank you,


@Sudarshan_Ghate wrote:

Thank you.  In the NXQL query, how do I pass the current folders id?

Typically you add a predicate for system -> parentId (aka ecm:parentId) to the PP and then pass the value using the "params" attribute. You may note that Nuxeo.DocumentContentBehavior hard-codes the predicate to "ecm_parentId" whereas Studio generates "system_parentId" so in that case, when using this behavior, you can override the "_computeParams" function; just create a function named "_computeParams" in the View layout for your Invoices document type and adjust the params.

 


@Sudarshan_Ghate wrote:

Also I am trying to find documentation on how the following should be set.  Can you point me in the right direction?

Sudarshan_Ghate_0-1741706044237.png

Thank you,


There shouldn't be any need to change "name". When you generate the View layout for a folderish document type, Studio generates the necessary code to manage "nxProvider". I.e. you just change the value of the "provider" attribute of the "nuxeo-page-provider" element:

 <nuxeo-page-provider provider="my-cool-pp" ...

 

--
Hyland Sales Solution Engineer