Categories > TinyButStrong general >

Problems creating a TreeView

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: MarceloReborn
Date: 2009-09-10
Time: 18:30

Problems creating a TreeView

Hello!

I'm trying to generate a Jquery TreeView, from a database.
My array structure is like:
{Brazil, RioDeJaneiro, 21000}
{Brazil, RioDeJaneiro, 75300}
{Brazil, SaoPaulo, 13000}

Then, it should genereate a tree like that:
Brazil
....|_RioDeJaneiro
....|....|_21000
....|....|_75300
....|
....|_SaoPaulo
.........|_13000

HTML:
<ul id="example" class="filetree">
                               
                                                   
                                                       
                            <li class="closed"><span class="folder">[blk_resultado2.COUNTRY;block=li;headergrp=COUNTRY]</span>
                                <ul>
                                    <li class="closed"><span class="folder">[blk_resultado2.STATE;block=li]</span>
                                        <ul>
                                            <li><span class="file">[blk_resultado2.ZIP;block=li]</span></li>
                                        </ul>                                      
                                    </li>
                               </ul>
                            </li>
                                             
                        </ul>

The HeaderGroup doesn't work in that case because the fields are nested!
By: MarceloReborn
Date: 2009-09-10
Time: 18:34

Re: Problems creating a TreeView

I forgot to show what's happening:

It generates a tree like:

Brazil
....|_RioDeJaneiro
....|....|_21000
....|
....|_SaoPaulo
.........|_13000

Missing the second ZIP children.
By: TomH
Date: 2009-09-10
Time: 23:49

Re: Problems creating a TreeView


Looks like you are expecting two levels of headers: COUNTRY and then STATE

SO try something like the following psuedo-code...
<ul id="example" class="filetree">
                              
                                                  
                           <li class="closed"><span class="folder">[blk_resultado2.COUNTRY;block=li;headergrp=COUNTRY]</span>
                             <ul>
                                 <li class="closed"><span class="folder">[blk_resultado2.STATE;block=li;headergrp=STATE]</span>
                                     <ul>
                                            <li><span class="file">[blk_resultado2.ZIP;block=li]</span></li>
                                        </ul>                                     
                                    </li>
                               </ul>
                            </li>
                                            
                        </ul>

HTH,
TomH