W3C home > Mailing lists > Public > www-forms@w3.org > May 2008

Re: Recursive tree display in a select1 or repeat

From: Andy Bailey <andy@hazlorealidad.com>
Date: Fri, 30 May 2008 08:28:43 -0500
Message-ID: <13967385.75161212154123972.JavaMail.root@mail.hazlorealidad.com>
To: raman@users.sf.net
Cc: www-forms@w3.org

Thanks for the suggestion, I had thought of that but I would have to
assume the maximum number of levels and write that number of nested

However, the data structure could have any number of levels. Also the
properties of the control for a leaf node are different from a branch
node, so it would make things kind complicated.

Is there no way to make the controls recursively. With xslt it would be
very easy, but I dont really want to mix client side xslt and xforms.

A select1 appearance="tree" would be very nice in the next version of


Andy Bailey

On Thu, 2008-05-29 at 06:33 -0700, T. V. Raman wrote:
> try nested repeats?
> Mikko had prototyped his tree control in x-smiles by using that
> as a basis.
> >>>>> "Andy" == Andy Bailey writes:
>     Andy> I sent a message to mozilla.dev.tech.xforms and someone
>     Andy> suggested that I post the message to this group- so
>     Andy> here goes:
>     Andy> 
>     Andy> I have a recursive data structure (see below), with any
>     Andy> number of levels and would like to display it in a
>     Andy> select1 the closest I can get so far is a flat select1
>     Andy> using //path however it would be nice to group the
>     Andy> options together.
>     Andy> 
>     Andy> 
>     Andy> Ideally I would like a tree structure where I could
>     Andy> expand/hide the child elements as well as select1
>     Andy> something like appearance="tree"
>     Andy> 
>     Andy> 
>     Andy> I see that you can write custom controls in firefox
>     Andy> with xul or xbl but have no experience with either and
>     Andy> also would like a standard xform solution. I thought of
>     Andy> using repeats as well but cant see any way to have any
>     Andy> number of levels.
>     Andy> 
>     Andy> 
>     Andy> If I used repeats how could I get the expand/hide
>     Andy> functionality?
>     Andy> 
>     Andy> 
>     Andy> In the repeat example I had to use index('part1')" in
>     Andy> <xf:setvalue bind="selectedpart"
>     Andy> value="index('part1')"/> "name" didnt work and if I put
>     Andy> value="name(.)" the selected part became the string
>     Andy> "selectedpart" can anyone explain why that is? I
>     Andy> assumed it would be the node of the repeat.
>     Andy> 
>     Andy> 
>     Andy> Also if I clicked with the mouse on the select1 each
>     Andy> time the model got updated but if I used the arrow keys
>     Andy> up/down then the model didnt get update even though
>     Andy> incremental="true", is this a bug in firefox or
>     Andy> expected behavior in xforms?
>     Andy> 
>     Andy> 
>     Andy> 
>     Andy> Thanks in advance
>     Andy> 
>     Andy> 
>     Andy> Andy Bailey http://www.hazlorealidad.com
>     Andy> 
>     Andy> 
>     Andy> <assembly> <name>Open source CNC Machine</name> <parts>
>     Andy> <part id="structure"> <name>Estructura</name> <parts>
>     Andy> <part id="base"> <name>Base</name> <parts> <part
>     Andy> id="baseStructure"> <name>Estructura</name> </part>
>     Andy> <part id="feet"> <name>Pies</name> </part> <part
>     Andy> id="antiVibration"> <name>Aisladores (anti
>     Andy> vibraciĆ³n)</name> </part> </parts> </part> ....
>     Andy> 
>     Andy>  <xf:select1 bind="selectedpart" appearance="full"
>     Andy> incremental="true"> <xf:label>Part Tree: </xf:label>
>     Andy> <xf:itemset nodeset="instance('assembly')//part">
>     Andy> <xf:label ref="name"/> <xf:value ref="@id"/>
>     Andy> </xf:itemset> </xf:select1>
>     Andy> 
>     Andy> 
>     Andy> <!-- <xf:repeat id="part1"
>     Andy> nodeset="instance('assembly')/parts/part"> <div
>     Andy> style="margin-left:0em;"> <xf:trigger ref=".">
>     Andy> <xf:label> <xf:output ref="name"/> </xf:label>
>     Andy> <xf:action ev:event="DOMActivate"> <xf:setvalue
>     Andy> bind="selectedpart" value="index('part1')"/>
>     Andy> <xf:message level="modal">Part Selected <xf:output
>     Andy> ref="name"/></ xf:message> </xf:action>
>     Andy> 
>     Andy> 
>     Andy> </xf:trigger> <xf:repeat id="part2"
>     Andy> nodeset="parts/part"> <div style="margin-left:2em;">
>     Andy> <xf:trigger ref="."> <xf:label> <xf:output ref="name"/>
>     Andy> </xf:label> </xf:trigger> <xf:repeat
>     Andy> nodeset="parts/part"> <div style="margin-left:2em;">
>     Andy> <xf:trigger ref="."> <xf:label> <xf:output ref="name"/>
>     Andy> </xf:label> </xf:trigger> </div> </xf:repeat> </div>
>     Andy> </xf:repeat> </div> </xf:repeat>
>     -->
>     Andy>
> --
> Best Regards,
> --raman
> Email:  raman@users.sf.net
> WWW:    http://emacspeak.sf.net/raman/
> AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
> PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
> Google: tv+raman
> IRC:    irc://irc.freenode.net/#emacs
Received on Friday, 30 May 2008 13:29:38 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:21 UTC