[Seaside] Use of onMouseOver: and onMouseOut: in Seaside 2.8x
ssastre at seaswork.com
Sat Nov 8 11:08:48 UTC 2008
No need to goo all up to the document (parent of everything in page). You can
make the parent component of the rows to observe the event.
Think as you would do it in a desktop app: the container can/should define the
policy of reaction of its children. Here is the same but web.
PD: about hacking like that.. you can just subclass WATableReport and customize
as you please. In the long run you'll tank yourself for doing that instead of
> -----Mensaje original-----
> De: seaside-bounces at lists.squeakfoundation.org
> [mailto:seaside-bounces at lists.squeakfoundation.org] En nombre
> de Rick Flower
> Enviado el: Sábado, 08 de Noviembre de 2008 00:36
> Para: Seaside - general discussion
> Asunto: Re: [Seaside] Use of onMouseOver: and onMouseOut: in
> Seaside 2.8x
> One more followup.. I'm getting somewhere -- just not sure where..
> Anyway, I've now modified the following code (yes, I realize
> I'm whacking
> up my image, but I can live with that!) :
> WATableReport>>renderRowNumber: index item: row on: html
> html tableRow
> script: (Scriptaculous.SUEvent new
> observe: (Scriptaculous.SUStream on: 'document')
> on: 'mouseover'
> do: (html effect highlight));
> style: 'background-color: ' , (self
> colorForRowNumber: index);
> with: [
> columns do: [ :each |
> self renderColumn: each row:
> row on: html ] ]
> are identical
> for each row, which makes me think that my '#observe' method above is
> wrong and is currently telling it to look at the entire
> document instead
> of the row in question.. Now, I tried changing 'document' to
> be 'foobar'
> and ensured that the above tableRow had #id: #foobar but no
> difference and
> Firebug was complaining about foobar not being defined..
> Anyway, I think I'm close.. Does anyone have better examples on the
> use of #observe: on: do:? There are only a few examples and
> none doing
> anything other than using the entire document..
> On Fri, November 7, 2008 4:58 pm, Rick Flower wrote:
> > Ok -- just to reply to myself.. I was missing the need to
> add SULibrary
> > to the list of libraries that the Dispatch editor
> indicates.. Once I did
> > that the prototype (and related) libraries were loaded so
> no more error..
> > Now, I did end up copying the code below to my test from one of the
> > Scriptaculous examples and it runs great and highlights
> EVERYTHING but I
> > only want it to highlight a single <TR> in a table when the
> mouse hovers
> > over it.. Any ideas how to tailor it to down-scope what it
> > MTIA!
> > html script: (Scriptaculous.SUEvent new
> > observe: (Scriptaculous.SUStream on: 'document')
> > on: 'mouseover'
> > do: (html effect highlight; id: Scriptaculous.SUEvent
> new element)).
> > On Fri, November 7, 2008 3:43 pm, Rick Flower wrote:
> >> By the way, I modified the existing Seaside Unit Test
> >> (WATableReportTest)
> >> to have a #renderContentOn: method as follows (the rest of
> the test code
> >> is the same) :
> >> WATableReportTest>>renderContentOn: html
> >> self session addLoadScript: (html selector
> >> add: 'tr.effect';
> >> do: [ :each |
> >> each element on: 'mouseover' do:
> >> '$(event.target).up(''tr'').addClassName(''highlight'')'.
> >> each element on: 'mouseout' do:
> >> '$(event.target).up(''tr'').removeClassName(''highlight'')']).
> >> html render: report.
> >> Unfortunately, I must be doing something wrong as Firebug complains
> >> about
> >> the use of '$$' below in the generated script... Any
> ideas what I've
> >> missed?
> >> 1/*<![CDATA[*/function
> >> </script>
> >> _______________________________________________
> >> seaside mailing list
> >> seaside at lists.squeakfoundation.org
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> seaside mailing list
> seaside at lists.squeakfoundation.org
More information about the seaside