From version < 6.1 >
edited by Thomas Mortagne
on 2017/02/03
To version < 7.1
edited by Thomas Mortagne
on 2017/02/03
<
Change comment: There is no comment for this version

Summary

Details

FAQCode.FAQClass[0]
answer
... ... @@ -8,7 +8,6 @@
8 8  * ##$object## = the displayed object
9 9  * ##$type## = the intended display mode (view, edit, hidden, search...)
10 10  * ##$value## = the property value
11 -(source: [[Sergiu Dumitriu on xwiki-users list>>http://xwiki.475771.n2.nabble.com/Help-with-custom-display-td508630.html]])
12 12  * ##$field## = the definition of the property (in the class)
13 13  
14 14  So, in a custom Page type property (or database list), if you want:

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)
  • $value = the property value
  • $field = the definition of the property (in the class)

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