Re: Recursive tree display in a select1 or repeat

Hi Andy,

I included my response in-line.

If you have any further questions please feel free ask them,

Nick Van den Bleeken  -  Research & Development Manager
Inventive Designers
Phone: +32 - 3 - 8210170
Fax: +32 - 3 - 8210171
Email: Nick_Van_den_Bleeken@inventivegroup.com

www-forms-request@w3.org wrote on 04/27/2008 04:22:59 PM:

> 
> 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. 
>
Currently XForms doesn't has a tree control, it is future feature 
candidate for XForms 2.0 (
http://www.w3.org/MarkUp/Forms/wiki/XForms_Future_Features). 
So the only solution for now is to create a custom control for the firefox 
XForms plug-in (I don't know how difficult/easy that is...).
 
> 
> 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. 
>

This isn't a bug in in the FireFox XForms processor, it is correct 
behavior. The value attribute of a setvalue action is evaluated relative 
to its single node binding (the first node of the bind in this case)  (
http://www.w3.org/TR/xforms11/#action-setvalue)
 
> 
> 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? 
>

The problem with the arrow keys in a select1 and incremental="true" when 
using the FireFox XForms plug-in seems a bug in that processor to me. (
http://www.w3.org/TR/xforms11/#sequence-for-select)
 
> 
> 
> 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> 
--> 
> 
> 
> 
> 
> 

Inventive Designers' Email Disclaimer:   http://www.inventivedesigners.com/email-disclaimer =
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--

Received on Wednesday, 7 May 2008 16:26:33 UTC