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

Recursive tree display in a select1 or repeat

From: T. V. Raman <raman@users.sf.net>
Date: Thu, 29 May 2008 06:33:02 -0700
Message-ID: <18494.45198.719852.397477@gargle.gargle.HOWL>
To: andy@hazlorealidad.com
Cc: www-forms@w3.org

try nested repeats?

Mikko had prototyped his tree control in x-smiles by using that
as a basis.

>>>>> "Andy" == Andy Bailey <andy@hazlorealidad.com> 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 Thursday, 29 May 2008 13:33:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:12 GMT