[Users] How to build a complex tree ?

Alessandro Pasotti apasotti at gmail.com
Mon Jan 11 17:04:46 CET 2010


Hello,
I'm trying to build a complex tree from my kml layer list.

The expected result is


+  Tourist Resource layers (folder)
[ ] Beni culturali (enable/disable all children when clicked)
     [ ] Castelli
     [ ] Musei

....
[ ] Tracks
    [ ] By foot
    [ ] By bike
        [ ] Mountain bike
        [ ] Racing bike
    [ ] By car
        [ ] Normal car
        [ ] Offroad 4X4
    ........

I have already generated a JSON tree like this:


{
     "leaf": false,
     "name": "Beni culturali",
     "kml": "/it/resource/poi/category/beni-culturali.kml",
     "id": "poi.2",
     "root": true,
     "children": [
      {
       "leaf": true,
       "name": "Castelli",
       "kml": "/it/resource/poi/category/castelli.kml",
       "id": "poi.2.4",
       "root": false,
       "children": [],
       "icon": "/static/poi/icons/48.png"
      },
      {
       "leaf": true,
       "name": "Musei",
       "kml": "/it/resource/poi/category/musei.kml",
       "id": "poi.2.3",
       "root": false,
       "children": [],
       "icon": "/static/poi/icons/55.png"
      }
     ],
     "icon": "/static/poi/icons/49.png"
    }
   ],


What is the beast approach, considering that I would like to use the
"icon" field to generate a custom icon instead of the default one ?
I'm trying with a  loader filter with no success.

Shall I build the tree node by node (by hand) or do you see a better solution ?


Cheers.

--
Alessandro Pasotti
w3:   www.itopen.it


More information about the Users mailing list