Recursive tree display in a select1 or repeat

I sent a message to mozilla.dev.tech.xforms and someone suggested that I
post the message to this group- so here goes:

I have a recursive data structure (see below), with any number of 
levels and would like to display it in a select1 
the closest I can get so far is a flat select1 using //path however it 
would be nice to group the options together. 


Ideally I would like a tree structure where I could expand/hide the 
child elements as well as select1 
something like appearance="tree" 


I see that you can write custom controls in firefox with xul or xbl but
have no 
experience with either and also would like a standard xform solution. I 
thought of using repeats as well but cant see any way to have any 
number of levels. 


If I used repeats how could I get the expand/hide functionality? 


In the repeat example I had to use index('part1')" in 
 <xf:setvalue bind="selectedpart" value="index('part1')"/> 
"name" didnt work and if I put value="name(.)" the selected part 
became the string "selectedpart" 
can anyone explain why that is? I assumed it would be the node of the 
repeat. 


Also if I clicked with the mouse on the select1 each time the model 
got updated but if I used the arrow keys up/down then the model didnt 
get update even though incremental="true", is this a bug in firefox or
expected behavior in xforms? 



Thanks in advance 


Andy Bailey 
http://www.hazlorealidad.com 


<assembly> 
  <name>Open source CNC Machine</name> 
  <parts> 
    <part id="structure"> 
      <name>Estructura</name> 
      <parts> 
        <part id="base"> 
          <name>Base</name> 
          <parts> 
            <part id="baseStructure"> 
              <name>Estructura</name> 
            </part> 
            <part id="feet"> 
              <name>Pies</name> 
            </part> 
            <part id="antiVibration"> 
              <name>Aisladores (anti vibraciĆ³n)</name> 
            </part> 
          </parts> 
        </part> 
....

 <xf:select1 bind="selectedpart" appearance="full" incremental="true"> 
         <xf:label>Part Tree: </xf:label> 
         <xf:itemset nodeset="instance('assembly')//part"> 
            <xf:label ref="name"/> 
            <xf:value ref="@id"/> 
         </xf:itemset> 
      </xf:select1> 


<!-- 
 <xf:repeat id="part1" nodeset="instance('assembly')/parts/part"> 
<div style="margin-left:0em;"> 
            <xf:trigger ref="."> 
<xf:label> 
<xf:output ref="name"/> 
</xf:label> 
<xf:action ev:event="DOMActivate"> 
       <xf:setvalue bind="selectedpart" value="index('part1')"/> 
<xf:message level="modal">Part Selected <xf:output ref="name"/></ 
xf:message> 
   </xf:action> 


</xf:trigger> 
 <xf:repeat id="part2" nodeset="parts/part"> 
<div style="margin-left:2em;"> 
            <xf:trigger ref="."> 
<xf:label> 
<xf:output ref="name"/> 
</xf:label> 
</xf:trigger> 
 <xf:repeat nodeset="parts/part"> 
<div style="margin-left:2em;"> 
            <xf:trigger ref="."> 
<xf:label> 
<xf:output ref="name"/> 
</xf:label> 
</xf:trigger> 
</div> 
      </xf:repeat> 
</div> 
      </xf:repeat> 
</div> 
      </xf:repeat> 
--> 

Received on Monday, 28 April 2008 12:36:52 UTC