No way to catch $prefix with velocity in my docSheet, then? :-(
Finally I adopt another 'ugly'? way to add some class and stuf in some DIV on 
my form: I reconstruct some DIV elements with velocity in "Custom Display" 
field of my docClass properties.
My purpose, I wanted add some nice bootstrap tooltips on my radio button 
generate by my docSheet.http://getbootstrap.com/javascript/#tooltips-examples
Here my example I can paste in XWIKI FAQ if it is a good way (I doubt it :-) 
):- I add a "Boolean" property in my docClass with form type "radio" and I 
paste this code in "Custom Display":***************************{{velocity}}
{{html clean=false}}
#if($type == "edit")
  #set ($MyToolTipText="Tooltip on top de mon bouton radio")
  #foreach( $i in [1..0] )
    <div>
    #if ($i==0)
      #set($LibReponse='Non')
      #set($SuffxLabel='_false')
      #if ($!value==0)
        #set($IsChecked='checked="checked"')
      #end
    #else
      #set($LibReponse='Oui')
      #if ($!value==1)
        #set($IsChecked='checked="checked"')
      #end
    #end
     <label for="${prefix}${name}$!{SuffxLabel}">
    <input id="${prefix}${name}$!{SuffxLabel}" type="radio" 
name="${prefix}${name}" value="$i" $!IsChecked data-toggle="tooltip" 
data-placement="right" title="$!{MyToolTipText}">
    $LibReponse
    </label>
    </div>
    #set($IsChecked='')
  #end
#elseif ($type == "view")
  #if ($!value==0)
    <strong>Non</strong>
  #elseif ($!value==1)
    <strong>Oui</strong>
  #end
#end
{{/html}}
{{/velocity}}

***************************I paste this xwiki.javascriptExtension to initiate 
Tooltips:require(['jquery'], function ($) {
$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})
});


(Notice: I didn't use full JS because I don't like the blinking effect or 
errors who's crash Xwiki menu)
Pascal B
      De : Pascal BASTIEN <pbasnews-xw...@yahoo.fr>
 À : XWiki Users <users@xwiki.org> 
 Envoyé le : Jeudi 29 janvier 2015 12h05
 Objet : [xwiki-users] Howto getprefix in a Sheet?
   


Hello,I have a docClass with some properties and use a linked Sheet to display 
my data.On this thread 
http://xwiki.475771.n2.nabble.com/Help-with-custom-display-td508630.htmlI saw 
we can get this value in "custom display" field of docClass properties.- $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 

I try to have same value from mydocSheet (in particulary prefix the id of the 
field in edit form)
There Velocity code in my docSheet:

#set($class = $doc.getObject('MySpace.docClass').xWikiClass)

#foreach($prop in $class.properties)
  * "$prop.Name"  * $prop.?????? How to obtain the prefix ???  * $object (it 
doesn't matter)  * $xcontext.action  * $doc.getValue($prop.Name)
  $prop.prettyName $doc.display($prop.getName())
#end
#break
If any have an (or many) idea how I can obtain this prefix in my Sheet
(If not I can concanet MySpace.docClass_0_$prop.Name but I'm not sure about _0_)

Thxs
Pascal B
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


  
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to