[Seaside] Seaside WATree

Philippe Marschall philippe.marschall at gmail.com
Sun Jun 5 13:34:47 UTC 2011

2011/6/5 Gaston Charkiewicz <gastonnnn at gmail.com>:
> Hello everyone!
> My name is Gastón Charkiewicz, I'm from Argentina, and I study IT
> Programming in de Quilmes National University (UNQ). I'm developing a
> certain domain in Seaside, and I want to model a folder hierarchy using a
> WATree (I'm just starting to use it).
> I have a "Folder" class, who haves a instance variable, "folders", a
> SortedCollection (sortBlock given) with more Folder s. So, I prepared a
> component called WAFolderTree, extending from WATree. It haves an instance
> variable, "folders", with the folder hierarchy it's going to show. I have
> this initialize mehod:

You shouldn't subclass WATree for this. Just create an instance and
configure it in your component.

> initialize
> super initialize.
> folders := Folder new.
> folders folderName: 'root'.
> folders subFolders add: (Folder new folderName: 'var').
> folders subFolders add: (Folder new folderName: 'usr').
>     self
>     root: folders;
>     labelBlock: [:f | f folderName];
>     childrenBlock: [:f | f subFolders];
>     yourself.
> (I'm just testing the class' vehaviour, I'm going to make it a Singleton
> class after testings, and make it beautier also :) ).
> The problem: when I render the containing window, I also render the tree
> using
> html render: WAFolderTree new.
> ...but I just get in screen "WAFolderTree". No +, even no selecting points.
> Could you help me?

That creates a new WAFolderTree every time the page is rendered. You
want to store it in an instance variable. Assign it in #initialize and
answer it in #children. Also check out the embedding section [1] in
the book.

 [1] http://book.seaside.st/book/components/embedding


More information about the seaside mailing list