[aida] Dropdown menus (was: addMenuAspect:...)
janko.mivsek at eranova.si
Mon Oct 15 11:35:08 CEST 2007
Dirk Verleysen wrote:
> Can I send an event after an item in the menu is selected ? I want 3 menus
> on 1 form and the collection of the 2nd menu is dependent on the selection
> of the first menu. The collection of the 3th menu is created after you know
> what was selected in the 2nd menu.
This is very common pattern and very nicely solved with Ajax updating of
an element containing all three menus. For that you use
onChangePostAndUpdate: on your menus:
| e |
e := WebElement new.
menu1 := WebMenu aspect: ....
menu1 onCangePostAndUpdate: e.
e add: menu1; addBreak.
menu2 := WebMenu aspect: ....
menu2 onCangePostAndUpdate: e.
e add: menu2; addBreak.
menu3 := WebMenu aspect: ....
e add: menu3.
> ----- Original Message -----
> From: "Janko Mivšek" <janko.mivsek na eranova.si>
> To: "AIDA/Web general discussion list" <aida na aidaweb.si>
> Sent: Monday, October 15, 2007 10:58 AM
> Subject: Re: [aida] addMenuAspect:collection:selectedToAspect:of:
>> Hi Dirk,
>> Dirk Verleysen wrote:
>>> Is there an example of this available ? I guess I can use this to create
>>> a kind of dropdownlist ?
>> In HTML it called menu
>> http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.6. In Aida
>> there is a WebMenu and here s short example of usage:
>> menu := WebMenu
>> aspect: #name
>> collection: self authors
>> selectedToAspect: #author
>> of: self.
>> or with convenience method:
>> anElement addMenuAspect:collection:selectedToAspect:of:
>> Here you select an author by name from self authors and save selected
>> object (not a name string!) to aspect #author (this calls
>> accessor/mutator #author and #author: ) of self. Note that if there is
>> author selected from before, it will be preselected.
>>> I use "anElement addMenuAspect: #name collection: self observee
>>> seasonColl selectedToAspect: #season of: self observee." but by the time
>>> my HTML is generated my aspectToStore has become #name and my
>>> objectToStore is nil.
>> And this you already solved by yourself.
>> Best regards
Smalltalk Web Application Server
More information about the Aida