Today we have a question from Ben who asks How can I replace the Last Contributor column in the default content view for sections and workspaces with the dc:source field?
In Nuxeo JSF UI, every time you see a listing (documents, audit events, anything really…), it’s displayed thanks to a content view.
A content view is a notion to define all the elements needed to get a list of items and perform their rendering. The most obvious use case is the listing of a folderish document content item, where we would like to be able to:
- define the NXQL query that will be used to retrieve the documents, filtering some of them (documents in the trash for instance)
- pass on contextual parameters to the query (the current container identifier)
- define a filtering form to refine the query
- define what columns will be used for the rendering of the list, and how to display their content
- handle selection of documents, and actions available when selecting them (copy, paste, delete…)
- handle sorting and pagination
- handle caching, and refresh of this cache when a document is created, deleted, modified…
So if you want to change the column of a document list, you need to go through its contentView. Its XML contribution as a resultLayouts tag containing the different listing layout contributions available to display the result of your contentView‘s query.
This layout is displaying a list of widgets for each of its columns. So what you need to do is replace the LastContributor widget by one displaying the dc:source field.
But what widget/layout/contentView is used in the content tab of a Section or Workspace document? This is decided in the types extension point . It has a contentViews tag looking like this:
The content tab displays all contentViews defined for the ‘content’ category. So what we have to do is override it for the Section and Workspace document.
And this is all you need to know to change a listing column. See ya’ on Monday!