Richard E. Flower | 11 Nov 08:28

General subclassing question with regards to callbacks...

Hi all...

I'm stumped once again -- it's probably just another ST thing that is  
throwing me for a loop..
Anyway, I've got a generic 'edit/add' widget that shows a list of  
records and then depending
on the personality selected (by the parent menu), it invokes either  
the vanilla 'add' class
to draw the form for a new record OR we render the 'editSelector'  
class who squirrels away the 'clickBlock'
for later (in case the user clicks/selects a particular user).  So, my  
initialize method and friends for the
EditSelector class looks like :

EditSelector>>initialize
	super initialize.
	userSelector := Admin_User_RecordSelector on: self.
	userEditor   := Admin_User_EditExecutor on: self.
	self userSelector clickBlock: [ : each |
		self userEditor user: each.
		self call: self userEditor.
	].

EditSelector>>renderContentOn:  html
	html render: userSelector.

While the above 'clickBlock' is valid, how its used elsewhere is not.  
See use of onClick:
below and above.. I would like to be able to determine once the user  
presses on
(Continue reading)

Lukas Renggli | 11 Nov 10:45

Re: General subclassing question with regards to callbacks...

>        "Override the onClick: method to do what we want..."
>        html tableRow id: 'row' , index asString;
>                class:  (self classForRowNumber: index);
>                script: (self componentScriptOn: index);
>                 onClick: [ self clickBlock ];
>                with: [columns
>                                do: [:ea | self

#onClick: expects a Javascript string or object. #onClick is a HTML
event attribute. You need to wrap the contents of your cells into an
anchor that uses the block as a #callback:, or restort to JavaScript
(AJAX).

Cheers,
Lukas

--

-- 
Lukas Renggli
http://www.lukas-renggli.ch
Richard E. Flower | 11 Nov 16:17

Re: General subclassing question with regards to callbacks...

Thanks Lukas.. I'll look into doing that.. I figured it was something  
stupid I was overlooking!
Too much late night coding!

-- Rick

On Nov 11, 2008, at 1:45 AM, Lukas Renggli wrote:

>>       "Override the onClick: method to do what we want..."
>>       html tableRow id: 'row' , index asString;
>>               class:  (self classForRowNumber: index);
>>               script: (self componentScriptOn: index);
>>                onClick: [ self clickBlock ];
>>               with: [columns
>>                               do: [:ea | self
>
> #onClick: expects a Javascript string or object. #onClick is a HTML
> event attribute. You need to wrap the contents of your cells into an
> anchor that uses the block as a #callback:, or restort to JavaScript
> (AJAX).
>
> Cheers,
> Lukas
>
> -- 
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> seaside <at> lists.squeakfoundation.org
(Continue reading)

Richard E. Flower | 12 Nov 08:03

Re: General subclassing question with regards to callbacks...

Lukas et-al,

I changed the code mentioned below to look like that below.. However,  
the anchors do NOT show up within the table
at all -- they're outside the table in a different DIV.. Any ideas  
why?  It doesn't seem to make sense to me anyway.
I tried some other variations and got the same result..  Any ideas?

I've also included some generated XHTML output for reference..

renderRowNumber: index item: row on: html
	| rowstr |

	rowstr := 'row' , index asString.

	"Override the onClick: method to do what we want..."
	html tableRow id: rowstr;
		class:  (self classForRowNumber: index);
		script: (self componentScriptOn: index);
		with: [
				html anchor onClick: (html updater id: rowstr; callback: [:r |
					self renderCompOn: r]); with: 'fooBar'.
				columns do: [:ea | self renderColumn: ea row: row on: html].
			]

<a href="javascript:void(0)" onclick="new Ajax.Updater('row1','http://localhost/seaside/foo' 
,{'evalScripts':true,'parameters': 
['_s=WtzsCxCrreiqkTeX','_k=UIrMuNmm','10'].join('&')})">fooBar</a>
<a href="javascript:void(0)" onclick="new Ajax.Updater('row2','http://localhost/seaside/foo' 
,{'evalScripts':true,'parameters': 
(Continue reading)

Lukas Renggli | 12 Nov 08:38

Re: General subclassing question with regards to callbacks...

>        "Override the onClick: method to do what we want..."
>        html tableRow id: rowstr;
>                class:  (self classForRowNumber: index);
>                script: (self componentScriptOn: index);
>                with: [
>                                html anchor onClick: (html updater id:
> rowstr; callback: [:r |
>                                        self renderCompOn: r]); with:
> 'fooBar'.
>                                columns do: [:ea | self renderColumn: ea row:
> row on: html].
>                        ]

You can't put an anchor tag in-between table rows and table cells.
Tables have a very strict nesting policy (see
http://www.w3.org/TR/REC-html40/struct/tables.html). A minimal valid
HTML table looks like this:

#table
     #tableBody (exactly one)
          #tableRow (one or more)
                #tableData or #tableHeading (one or more)

Actually there are a couple of more things to consider, but that is the basics.

Note that the #onClick: Javascript event you can define on any DOM
node. Only if you want to use a traditional #callback: you need to use
an anchor.

Lukas
(Continue reading)

Richard E. Flower | 12 Nov 16:25

Re: General subclassing question with regards to callbacks...

Thanks.. I guess I need to think about it a bit more before it jells  
in my head..

On Nov 11, 2008, at 11:38 PM, Lukas Renggli wrote:

>>       "Override the onClick: method to do what we want..."
>>       html tableRow id: rowstr;
>>               class:  (self classForRowNumber: index);
>>               script: (self componentScriptOn: index);
>>               with: [
>>                               html anchor onClick: (html updater id:
>> rowstr; callback: [:r |
>>                                       self renderCompOn: r]); with:
>> 'fooBar'.
>>                               columns do: [:ea | self renderColumn:  
>> ea row:
>> row on: html].
>>                       ]
>
> You can't put an anchor tag in-between table rows and table cells.
> Tables have a very strict nesting policy (see
> http://www.w3.org/TR/REC-html40/struct/tables.html). A minimal valid
> HTML table looks like this:
>
> #table
>     #tableBody (exactly one)
>          #tableRow (one or more)
>                #tableData or #tableHeading (one or more)
>
> Actually there are a couple of more things to consider, but that is  
(Continue reading)

Boris Popov | 12 Nov 16:42

RE: General subclassing question with regards tocallbacks...

Lukas,

I don't mean to nitpick, but you can have more than one body in a table,
one for each row group.

Cheers,

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5
http://tinyurl.com/r7uw4

boris <at> deepcovelabs.com

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message header.
Unless otherwise indicated, it contains information that is private and
confidential. If you have received it in error, please notify the sender
and delete the entire message including any attachments.

Thank you.

-----Original Message-----
From: seaside-bounces <at> lists.squeakfoundation.org
[mailto:seaside-bounces <at> lists.squeakfoundation.org] On Behalf Of Lukas
(Continue reading)

Rick Flower | 12 Nov 18:58

RE: General subclassing question with regards tocallbacks...

Thanks for the comment Boris.. In a nutshell all I want to be able to do
is to have a table of names (or whatever) and be able to click anywhere on
that row and have a callback (or block or ??) get rendered that can work
on the 'selected row'..  I've got the code that changes the coloring when
you hover over a row but the callback/block processing is what's getting
me stumped.. Anyway, I'll continue looking at this some more this evening.
Thanks for the insight..

On Wed, November 12, 2008 7:42 am, Boris Popov wrote:
> Lukas,
>
> I don't mean to nitpick, but you can have more than one body in a table,
> one for each row group.
>
> Cheers,
>
> -Boris
>
> --
> +1.604.689.0322
> DeepCove Labs Ltd.
> 4th floor 595 Howe Street
> Vancouver, Canada V6C 2T5
> http://tinyurl.com/r7uw4
>
> boris <at> deepcovelabs.com
>
> CONFIDENTIALITY NOTICE
>
> This email is intended only for the persons named in the message header.
(Continue reading)


Gmane