[Seaside] Usage of Canvas' #select and #labels

Boris Popov boris at deepcovelabs.com
Fri Apr 6 19:07:31 UTC 2007


No, personally I would much rather see,

labels: [:o | o ifNil: [] ifNotNil: []];
enablement: [:o | o notNil];

Its just a little more consistent, your suggestion seems very specialized IMHO and this would still work and be readable.

Cheers!

-Boris
(Sent from a BlackBerry)

----- Original Message -----
From: seaside-bounces at lists.squeakfoundation.org <seaside-bounces at lists.squeakfoundation.org>
To: sea >> "The Squeak Enterprise Aubergines Server - general discussion." <seaside at lists.squeakfoundation.org>
Sent: Fri Apr 06 11:57:59 2007
Subject: [Seaside] Usage of Canvas' #select and #labels

Hi all..

I'm trying to find a way to cleanup some of my existing code. I've got,
in a handful of places, items coming out of a Glorpified database and
use this data as the items in various Canvas API #select lists for
various forms I've got. 

What I currently do is prepend an item to the front of the select array
when the component is initially drawn by Seaside that has text similar
to  "Select one..."..   I've got code that will take the array that I
get back from Glorp and add a nil item to the front of the array that I
can then check for in the labels: code block -- if the item being
processed is nil, then I make the label say 'Select one...', otherwise
use the database data.. Below is the code I use more or less to
achieve this :

html select list: orgs ; 
   callback: [:i | self orgId: i];
   labels: [:org | org = '' ifTrue: [ 'Select One..' ] ifFalse: [ org name ] ].

Does anyone use anything more elegant to overcome this or is everyone
selecting their data directly from the database items without the need
for a 'select one...' initially selected label?  I'd love to ditch the code
I've got that has to manipulate the array I get from Glorp along with the
extra code to fiddle w/ Seaside labels to do what I want.. 

I guess I could take a stab at writing up a modification to the Canvas
API's #select method that takes an #initiallySelectedLabel: method call
to set the name for that initially selected label item -- would anyone
else find that useful?  Perhaps the result would allow for something like
the following: 

html select list: orgs ; 
   callback: [:i | self orgId: i];
   labels: [:org | org name ];
   initiallySelectedLabel: 'Select One...'.

Comments?
_______________________________________________
Seaside mailing list
Seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070406/ae7eafe0/attachment.htm


More information about the Seaside mailing list