[Seaside] Use of onMouseOver: and onMouseOut: in Seaside 2.8x

Richard E. Flower rickf at ca-flower.com
Fri Nov 7 14:58:16 UTC 2008


Garhard -

Thanks!  One more stupid question..  Where does that fit into the rest  
of the rendering code that
is creating the TableRows? Is this going to be put in for any TR's for  
the entire form that was rendered
and there is no relationship (direct anyway) between the two?  Anyway,  
just curious.. Thx!

-- Rick


On Nov 7, 2008, at 12:37 AM, Gerhard Obermann wrote:

> Hi!
>
> You could try something like this!
> You will need an extra CSS class for your rows!
>
>      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'')']).
>
> cheers
> Gerhard
>
> On Fri, Nov 7, 2008 at 7:55 AM, Richard E. Flower <rickf at ca- 
> flower.com> wrote:
> On Nov 6, 2008, at 1:11 AM, Sebastian Sastre wrote:
>
>
> Hi Richard,
>
> that will be rendered as javascript so you can't expect a server  
> side halt for
> code that runs in DOM unless a callback is envolved. Unfortunately  
> there is not
> Firebug code halts yet to mimic our debugging style. I miss that when
> javascripting.
>
> You can use this to check in firebug's console if your code executes  
> under your
> condition:
>
>        SUScript new
>                add: (SULogger new log: 'The mouse is over!');
>                add: (your javascript serius code here);
>                yourself
>
> Usage of onClick, onMouseOver, etc are considered the "vile way" to  
> do it.
> Instead prefer observe(). Details here:
> http://www.prototypejs.org/api/event/observe
>
> Sebastian-
>
> I don't suppose you've got an example using the above mentioned  
> observe() code in Prototype
> do you?  Is this what is used by Scriptaculous' SUElement?  I saw a  
> reference to 'observe'
> in there but wasn't sure.. I've just spent the last hour or so  
> looking thru the old email
> archives for this list and saw some tidbits but no concrete  
> examples..  I also looked at the test
> code for Scriptaculous but nothing similar to what I want to do,  
> which is to change the css for
> an id when the mouse goes over the row in a table...
>
> I saw a reference in an email you wrote this past August talking  
> about using :
>
> ========================
> >From Seaside you access that with anElement>>on: anEventString do:
> aHandlerObject
> With prototype you can even use your own custom events like this:  
> anElement
> fire: 'mouse:enter'
> ========================
>
> However, I'm not sure about the context in which to use the above..   
> An example would
> be great!
>
> Currently my row rendering code looks something like :
>
>
> renderRowNumber: index item: row on: html
>
>        html tableRow id: 'row' , index asString;
>                class: (self classForRowNumber: index);
>                script: (self componentScriptOn: html);
>
>                 onClick: (html evaluator
>                        callback: [:aScript | self  
> adjustRowColorsUsingIndex: index onScript: aScript];
>                         return: false);
>                with: [columns
>                                do: [:ea | self
>                                                renderColumn: ea
>                                                row: row
>                                                on: html]]
>
> componentScriptOn: html
>
>        ^(Scriptaculous.SUScript new
>                add: (Scriptaculous.SUEvent new
>                        observe: html scriptaculous document
>                        on: 'mouseover'
>                        do: (Scriptaculous.SULogger new log: 'The  
> mouse is over!')
>                        ); yourself;
>        yourself).
>
> ====================================================
> When I execute this with Firefox (and Firebug) I get the following  
> error in the console window:
>
> Event.observe is not a function
>  onLoad()
>  onLoad(load)
>
>
> _______________________________________________
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20081107/e0bf6ed0/attachment.htm


More information about the seaside mailing list