Question about WATree

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about WATree

Brian Brown-2
Hello all,

I'm trying to use WATree with a relational database on the back end -  
it doesn't seem to want to go beyond the second level.

I'm using it with ROE, and creating it as such:

setupTree
        ^ WATree new
                root: (categories where: #parentid equals: -1) asArray first;
                labelBlock: [:cat | cat name];
                childrenBlock: [:cat | categories where: #parentid equals: cat id];
                yourself


The data looks like this(If you look at in in monspace, it's easier  
to read :):
  id |         name          
|                                                                      
description                                                              
         |      image      | parentid
----+----------------------
+-----------------------------------------------------------------------
------------------------------------------------------------------------
------+-----------------+----------
   0 | Top                  | Top Level  
Categories                                                              
                                                                   |  
educational.png |       -1
   2 | Independent Living   | Tasks for independent and supported  
living, such as cooking, cleaning, money management, using household  
appliances, and practicing healthy living. | independent.png |        0
   3 | Educational          | Tasks for academic settings, such as  
using the library, recognizing bird songs, or learning the sounds of  
musical instruments.                      | educational.png |        0
   4 | Vocational           | Work related tasks, such as using a FAX  
machine, cleaning offices, filling out a time card,  
etc.                                                    |  
vocational.png  |        0
   5 | Recreation & Leisure | Task instructions for activities, such  
as learning to play games, learning about local parks and museums,  
etc.                                      | recreation.png  |        0
   6 | Community Access     | Assistance for community-based  
activities, such as taking the bus, using a pay phone, using an ATM,  
learning traffic signs, etc.                    | community.png    
|        0
   7 | Health & Wellness    | Medical and Hygiene  
related                                                                  
                                                         |  
health.png      |        0
   9 | Cooking              | Preparing meals  
independently                                                            
                                                             |  
cooking.png     |        2
10 | Breakfast            | Preparing Breakfast  
meals                                                                    
                                                         |  
cooking.png     |        9
11 | How To               | How to do various  
things                                                                  
                                                           |  
cooking.png     |        3
12 | Other                | Not  
categorized                                                              
                                                                         
  | independent.jpg |        0
(11 rows)


The tree comes out like:

-Top
        +Independent Living
        +Educational
        Vocational
        Recreation & Leisure
        Community Access
        Health & Wellness
        Other


... which is perfect. As you can see from the data, Independent  
Living and Educational both have children; clicking on the + does  
nothing. However, the Top entry can be collapsed and expanded at  
will. I have no idea why it won't expand the lower two.

Anyone have any ideas?

thanks!

Brian


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Question about WATree

cbeler

> Hello all,
>
> I'm trying to use WATree with a relational database on the back end -
> it doesn't seem to want to go beyond the second level.
>
> I'm using it with ROE, and creating it as such:
>
> setupTree
>     ^ WATree new
>         root: (categories where: #parentid equals: -1) asArray first;
>         labelBlock: [:cat | cat name];
>         childrenBlock: [:cat | categories where: #parentid equals: cat
> id];
>         yourself
maybe you should put a self halt in your children block to see what happen
...
childrenBlock: [:cat | self halt. categories where: #parentid equals:
cat id];



Cédrick
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Question about WATree

Brian Brown-2
In reply to this post by Brian Brown-2
I solved this issue, and it was that the WATree>>initialize uses an  
IdentitySet to compare the items. I changed it to Set and everything  
behaves the way I think it should.

Regards,

Brian



On Nov 22, 2006, at 5:25 PM, Brian Brown wrote:

> Hello all,
>
> I'm trying to use WATree with a relational database on the back end  
> - it doesn't seem to want to go beyond the second level.
>
> I'm using it with ROE, and creating it as such:
>
> setupTree
> ^ WATree new
> root: (categories where: #parentid equals: -1) asArray first;
> labelBlock: [:cat | cat name];
> childrenBlock: [:cat | categories where: #parentid equals: cat id];
> yourself
<chop>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside