[Seaside] Suggested extension for WASelectTag

Paul DeBruicker pdebruic at gmail.com
Sun Jul 2 16:34:25 UTC 2017


Hi Joachim,

I don't think you missed an existing way to set an attribute on a select tag
option.  Other than iterating over the options like in e.g.
WAInputElementContainer>>#renderSingleSelectionCustomOn: I don't know how to
set them. 


Seems like your method is more convenient than iterating over the option
tags.  I'd add it for sure.  


Paul



jtuchel wrote
> Hi,
> 
> 
> I needed a way to add an attribute of each option in a select list, 
> because Seaside uses the value attribute for its server side callback.
> 
> The reason was I wanted to do something on the browser side 
> onChange/onKeyUp based on some business values.
> 
> 
> Here is what I changed in WASelectTag:
> 
> * added inst var: itemConfigBlock with getter and setter
> 
> * changed #renderListItemLabelled: to
> 
> 
> renderListItem: anObject labelled: aString
> 
>      | option |
> 
>      option := canvas option.
>      self hasCallback ifTrue: [option value: (self valueFor: anObject)].
>      titleBlock isNil ifFalse: [option title: (self titleFor: anObject)].
>      itemConfigBlock ifNotNil: [:block | block value: option value: 
> anObject].
>      option
>          selected: (self isSelected: anObject);
>          disabled: (self isEnabled: anObject) not;
>          with: aString
> 
> 
> And this is how you can use it:
> 
> 
> html select
> 
>      items: MyListOfItems;
> 
>      callback: [];
> 
>      itemConfigBlock: [:option :anObject| option attrbibuteAt: 
> 'data-value' put: anObject someValue asString].
> 
> 
> Was this available already and did I overlook it?
> 
> Does this sound reasonable? Worth adding to Seaside?
> 
> 
> Joachim
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> -----------------------------------------------------------------------
> Objektfabrik Joachim Tuchel          mailto:

> jtuchel@

> Fliederweg 1                         http://www.objektfabrik.de
> D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
> Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1
> 
> _______________________________________________
> seaside mailing list

> seaside at .squeakfoundation

> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside





--
View this message in context: http://forum.world.st/Suggested-extension-for-WASelectTag-tp4953167p4953223.html
Sent from the Seaside General mailing list archive at Nabble.com.


More information about the seaside mailing list