From version < 4.1 >
edited by Pascal Bastien
on 2015/07/23
To version < 5.1 >
edited by Pascal Bastien
on 2017/02/02
< >
Change comment: fixed break link (due to new name of subwiki extension)

Summary

Details

FAQCode.FAQClass[0]
answer
... ... @@ -1,4 +1,5 @@
1 -In a doc Class, properties have "Custom Display" field , to display data in a ... custom way, like [[extensions:Extension.User Property Custom Display]] by example.
1 +In a doc Class, properties have "Custom Display" field , to display data in a ... custom way, like [[snippets:Extension.User Property Custom Display]] by example.
2 +User Property Custom Display
2 2  
3 3  Here some velocity script you can use in this field. The core make available the following variables:
4 4  

In a doc Class, properties have "Custom Display" field , to display data in a ... custom way, like User Property Custom Display by example.

In a doc Class, properties have "Custom Display" field , to display data in a ... custom way, like User Property Custom Display by example.
User Property Custom Display

Here some velocity script you can use in this field. The core make available the following variables:

  • $name = the name of the displayed field
  • $prefix = a prefix for the form field
  • $object = the displayed object
  • $type = the intended display mode (view, edit, hidden, search...)
  • $value = the property value
    (source: Sergiu Dumitriu on xwiki-users list)

So, in a custom Page type property (or database list), if you want:

  • in edit mode a select list to choose a page or nothing
  • in view mode a link to the page chosen page (or nothing)

Here a "Custom Display" field:

{{velocity}}
#if ($type == 'edit')
 #set($MyClass=$object.getxWikiClass())
 #set($list=$MyClass.get($name).getListValues())
 #set ($MySelectList="")
 #set ($MySelectList=$MySelectList  + "")
 {{html clean=false}}
  $MySelectList
 {{/html}}
#elseif (($type == 'view') && ($!value!=''))
  [[$value||rel="_blank"]]
#else
  $value
#end
{{/velocity}}
 

Of course, you can use a similar code in the Sheet to display data like you want.

Get Connected