Yes thanks you both.

In editobject.vm

#macro(displayObject $obj $class $props $firstField)
  <div id="xobject_${escapetool.xml($class.name)}_${obj.number}" 
class="xobject">

Then i think, I found the solution to get prefix in a sheet:

#set ($DocClass= 'MySpace.MydocClass')
#set($class = $doc.getObject(${DocClass}).xWikiClass)
##Boucle sur toutes les properties de la classe DocClass
#foreach($prop in $class.properties)
* ${escapetool.xml($class.name)}_${class.number}_$prop.Name
#end

Notice: sorry about miss formating mail, I think it is yahoo webmail fault?

Pascal B.

--------------------------------------------
En date de : Mar 3.2.15, Clemens Klein-Robbenhaar <c.robbenh...@espresto.com> a 
écrit :

 Objet: Re: [xwiki-users] Howto getprefix in a Sheet?
 À: users@xwiki.org
 Date: Mardi 3 février 2015, 10h38
 
 
 The
 number is not the number of the property in the class, but
 the number of the object on the page.
 I.e.
 you can have one, two, or manye objects of the same type
 MySpace.MyClass on the same page.
 
 A Macro where you can see how the ID gets
 rendered is in templates/editobject.vm and/or 
 webapps/xwiki/skins/flamingo/editobject.vm
 see the #macro displayObject
 
 
 On 02/03/2015
 10:12 AM, Pascal BASTIEN wrote:
 > ThxsI
 verified and it seem it is always _0_  for each properties
 (even for multiple properties of same type)ie If I have 2
 properties with 'date' type in MySpace.MyClass
 (date_entry and birthday), $doc.display($prop.getName() will
 generate this form
 > <input
 id="MySpace.MyClass_0_date_entry" xxxx<input
 id="MySpace.MyClass_0_birthday"  xx
 > But If I have a 'database list'
 with checkbox property "BirthdayYear" in
 MySpace.MyClass, $doc.display($prop.getName() will generate
 this form (with 2 similar hidden input field ! Maybe a bug?)
 :<label class="xwiki-form-listclass"
 for="xwiki-form-A_Expert-0-0"><input
 id="xwiki-form-A_Expert-0-0"
 type="checkbox" value="1980"
 name="MySpace.MyClass_0_BirthdayYear">1980</label><label
 class="xwiki-form-listclass"
 for="xwiki-form-BirthdayYear-0-1"><input
 id="xwiki-form-A_Expert-0-1"
 type="checkbox" value="1981"
 name="MySpace.MyClass_0_BirthdayYear">1981</label>...
 > <label
 class="xwiki-form-listclass"
 for="xwiki-form-BirthdayYear-0-n"><input
 id="xwiki-form-A_Expert-0-n"
 type="checkbox" value="20nn"
 name="MySpace.MyClass_0_BirthdayYear">
 20nn</label><input type="hidden"
 value=""
 name="MySpace.MyClass_0_BirthdayYear"><input
 type="hidden" value=""
 name="MySpace.MyClass_0_BirthdayYear"> I
 didn't find what is generate this _0_ (macro or java
 stuf)
 > ThxsPascal B
 >
 
 >       De : Marius Dumitru
 Florea <mariusdumitru.flo...@xwiki.com>
 >  À : Pascal BASTIEN <pbasnews-xw...@yahoo.fr>;
 XWiki Users <users@xwiki.org>
 
 >  Envoyé le : Mardi 3 février 2015
 8h16
 >  Objet : Re: [xwiki-users] Howto
 getprefix in a Sheet?
 >    
 > ...
 >> 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_)
 > 
 >
 I'm afraid you have to compute the prefix yourself. 0
 represents the
 > object number. So
 MySpace.MyClass_4_age refers to the 'age'
 property
 > of the MySpace.MyClass object
 with number 4 (normally the fifth object
 > of that type from the target document).
 > 
 > Hope this helps,
 > Marius
 > 
 > 
 > 
 >>
 >> 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
 > 
 
 
 
 mit freundlichen Grüßen
 Clemens Klein-Robbenhaar
 
 -- 
 Clemens Klein-Robbenhaar
 Software Development
 EsPresto
 AG
 Breite Str. 30-31
 10178
 Berlin/Germany
 Tel: +49.(0)30.90 226.763
 Fax: +49.(0)30.90 226.760
 robbenh...@espresto.com
 
 HRB 77554 B -
 Berlin-Charlottenburg
 Vorstand: Maya
 Biersack, Peter Biersack
 Vorsitzender des
 Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber
 Zertifiziert nach ISO 9001:2008
 _______________________________________________
 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