How can I get document label and use it in result of content view

I create a document type “bilan_carbone” with label “Bilan Carbone”.
Then I create a content view, and in results I have a column with document type (Document). But this column display the ID of the document type instead of label.
How can I display label of this document type ?

alt text

I configure this document type in Studio. Here the capture of configuration :
alt text Then the configuration of my content view where show document type ID instead of document type label . I use the widget system:document type:
alt text

Thanks in advance.

0 votes

3 answers



Can you describe where you put the label "Bilan Carbone"? Is it in the document type configuration in Studio? The result layout looks like it's customized. What kind of widget are you using on this column configuration?

Thanks for the extra info (please leave a comment when you modify your post so that we get notified).

I'll have a look.


There is not default widget type displaying the label of a given document type (except the one also displaying an icon), and the system widget you're using will just display the id of the document type.

The easiest would be to define an advanced widget template with the following content:

<div xmlns:nxd=""
  <h:outputText value="#{messages[nxd:typeLabel(field)]}" />

In the widget definition, you'll have to map a “field” to item “data” as in result layouts, each bound item is a wrapper object of the document.

1 votes

Ok, but if I want to filter the documents in the "result layouts" by document label, How would I do it?

You'll need to define a custom widget template too to generate the list of selections, retrieving the label for each of the types you'd like to display (similarly to what you explained on your answer).

Thanks for your help. I will test that quickly !

Hello, I search to do the same action. I have created a widget and I search to have the labl of the document type, but nothing happend. my widget :

but when I use the widget in creation view, I don't know how to configure the widget, can you help me ? thanks

0 votes

should to do a new question

I think you have to check the translate field into the definition of your widget that displays this item and add the translation key/value into your file that you can download from Resources in Studio.

Hopes this help.

0 votes

Thanks for your answer. But it's not an item but the label of document type. In the picture it's display the ID of this document type. Perhaps another idea ?