<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Johan,<br>
<br>
so #dispatchCallback was my missing piece... Thanks!<br>
<br>
I agree with your preference, for cases where you want to iterate
over myItems. This sure would be a nicer API than what we have
now.<br>
<br>
Joachim<br>
<br>
<br>
<br>
<br>
Am 03.07.17 um 09:19 schrieb Johan Brichau:<br>
</div>
<blockquote
cite="mid:7718AAB5-3E36-439E-ADE6-E887C918D621@inceptive.be"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Hi guys,
<div class=""><br class="">
</div>
<div class="">I would prefer that Seaside is able to do this:</div>
<div class=""><br class="">
</div>
<div class="">html select</div>
<div class=""> callback: …;</div>
<div class=""> with:[ </div>
<div class=""> myItems do:[:anItem |</div>
<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>
html option</div>
<div class=""> <span class="Apple-tab-span" style="white-space:pre"> </span>
attributeAt: … put: …;</div>
<div class=""> <span class="Apple-tab-span" style="white-space:pre"> </span>value:
anItem ] ]</div>
<div class=""><br class="">
</div>
<div class="">Right now, you must do it like this (i.e. add a
callback for each option):</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">html select</div>
<div class=""> dispatchCallback;</div>
<div class=""> with:[ </div>
<div class=""> myItems do:[:anItem |</div>
<div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>
html option</div>
<div class=""> <span class="Apple-tab-span" style="white-space: pre;"> </span>
attributeAt: … put: …;</div>
<div class=""> callback: [ …. ]</div>
<div class=""> <span class="Apple-tab-span" style="white-space: pre;"> </span>value:
anItem ] ]</div>
</div>
<div class=""><br class="">
</div>
<div class="">cheers,</div>
<div class="">Johan </div>
<div class=""><br class="">
</div>
<div class="">
<div>
<blockquote type="cite" class="">
<div class="">On 3 Jul 2017, at 02:23, Mariano Martinez Peck
<<a moz-do-not-send="true"
href="mailto:marianopeck@gmail.com" class="">marianopeck@gmail.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">
<div class="gmail_extra"><br
class="Apple-interchange-newline">
<br class="">
<div class="gmail_quote">On Sat, Jul 1, 2017 at 2:24
AM,<span class="Apple-converted-space"> </span><a
moz-do-not-send="true"
href="mailto:jtuchel@objektfabrik.de" class="">jtuchel@objektfabrik.de</a><span
class="Apple-converted-space"> </span><span
dir="ltr" class=""><<a moz-do-not-send="true"
href="mailto:jtuchel@objektfabrik.de"
target="_blank" class="">jtuchel@objektfabrik.de</a>></span><span
class="Apple-converted-space"> </span>wrote:<br
class="">
<blockquote class="gmail_quote" style="margin: 0px
0px 0px 0.8ex; border-left-width: 1px;
border-left-style: solid; border-left-color:
rgb(204, 204, 204); padding-left: 1ex;">Hi,<br
class="">
<br class="">
<br class="">
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.<br
class="">
<br class="">
The reason was I wanted to do something on the
browser side onChange/onKeyUp based on some
business values.<br class="">
<br class="">
<br class="">
Here is what I changed in WASelectTag:<br class="">
<br class="">
* added inst var: itemConfigBlock with getter and
setter<br class="">
<br class="">
* changed #renderListItemLabelled: to<br class="">
<br class="">
<br class="">
renderListItem: anObject labelled: aString<br
class="">
<br class="">
<span class="Apple-converted-space"> </span>|
option |<br class="">
<br class="">
<span class="Apple-converted-space"> </span>option
:= canvas option.<br class="">
<span class="Apple-converted-space"> </span>self
hasCallback ifTrue: [option value: (self valueFor:
anObject)].<br class="">
<span class="Apple-converted-space"> </span>titleBlock
isNil ifFalse: [option title: (self titleFor:
anObject)].<br class="">
<span class="Apple-converted-space"> </span>itemConfigBlock
ifNotNil: [:block | block value: option value:
anObject].<br class="">
<span class="Apple-converted-space"> </span>option<br
class="">
<span class="Apple-converted-space"> </span>selected:
(self isSelected: anObject);<br class="">
<span class="Apple-converted-space"> </span>disabled:
(self isEnabled: anObject) not;<br class="">
<span class="Apple-converted-space"> </span>with:
aString<br class="">
<br class="">
<br class="">
And this is how you can use it:<br class="">
<br class="">
<br class="">
html select<br class="">
<br class="">
<span class="Apple-converted-space"> </span>items:
MyListOfItems;<br class="">
<br class="">
<span class="Apple-converted-space"> </span>callback:
[];<br class="">
<br class="">
<span class="Apple-converted-space"> </span>itemConfigBlock:
[:option :anObject| option attrbibuteAt:
'data-value' put: anObject someValue asString].<br
class="">
<br class="">
<br class="">
Was this available already and did I overlook it?<br
class="">
<br class="">
Does this sound reasonable? Worth adding to
Seaside?<br class="">
<br class="">
<br class="">
</blockquote>
<div class=""><br class="">
</div>
<div class="">Yes, I had to do exactly the same. </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
--<span class="Apple-converted-space"> </span><br
class="">
<div class="gmail_signature"
data-smartmail="gmail_signature">Mariano<br class="">
<a moz-do-not-send="true"
href="http://marianopeck.wordpress.com/"
target="_blank" class="">http://marianopeck.wordpress.com</a><br
class="">
</div>
</div>
</div>
<span style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; float: none; display:
inline !important;" class="">_______________________________________________</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; float: none; display:
inline !important;" class="">seaside mailing list</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">
<a moz-do-not-send="true"
href="mailto:seaside@lists.squeakfoundation.org"
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; orphans:
auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class="">seaside@lists.squeakfoundation.org</a><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">
<a moz-do-not-send="true"
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; orphans:
auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class="">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a></div>
</blockquote>
</div>
<br class="">
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
</blockquote>
<br>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel <a class="moz-txt-link-freetext" href="mailto:jtuchel@objektfabrik.de">mailto:jtuchel@objektfabrik.de</a>
Fliederweg 1 <a class="moz-txt-link-freetext" href="http://www.objektfabrik.de">http://www.objektfabrik.de</a>
D-71640 Ludwigsburg <a class="moz-txt-link-freetext" href="http://joachimtuchel.wordpress.com">http://joachimtuchel.wordpress.com</a>
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
</pre>
</body>
</html>