[Seaside] [ADD] WASelectTag>>enablementBlock

Boris Popov boris at deepcovelabs.com
Tue Mar 27 00:27:09 UTC 2007


If you ever needed to build a list with certain elements that aren't
supposed to be selectable, here's a change that lets you do the
following,

(html select)
 list: self countyChoices;
 selected: self country;
 enablementBlock: [:ea | ea notNil];
 labels: [:ea | ea
                 ifNil: ['-----------------------------']
                 ifNotNil: [ea description]];
 callback: [:value | self country: value]

where #countryChoices returns a collection of countries separated by nil
into section with most popular countries and the rest underneath.

Changes,

WASelectTag>>enablementBlock: aBlock
 enablementBlock := aBlock

WASelectTag>>isDisabled: option
 ^enablementBlock notNil and: [(enablementBlock value: option) not]

WASelectTag>>optionsOn: html
 ...
 brush := (html option)
		disabled: (self isDisabled: each);
		selected: (self isSelected: each);
		yourself.
 ...

Hope this gets integrated at some point :)

Cheers!

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

boris at deepcovelabs.com

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.



More information about the seaside mailing list