[Seaside] General subclassing question with regards to callbacks...

Richard E. Flower rickf at ca-flower.com
Tue Nov 11 07:28:12 UTC 2008

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 :

	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
a row to select that user and perform an operation on them (whether it  
be delete or edit).
Anyway, the clickBlock which will handle the task portion of it is  
failing indicating that
the wrong argument count was specified (expects 1, got 0).  Any ideas?  
Hope this makes

-- Rick

Admin_User_RecordSelector >>initialize

	super initialize.
	clickBlock := nil.
	columns := OrderedCollection new
		add: (WAReportColumn selector: #familyId title: 'Family ID');  
"selector gets performed on your data item"
		add: (WAReportColumn selector: #nameLast title: 'Family Last Name ');

Admin_User_RecordSelector >>renderContentOn:  html

	"Get the current list of users to show..."
	self rows: (self users).
	html break.
      html paragraph class: 'legend_lookalike'; with: 'Select a Family  
to Edit - click on a family name'.
	super renderContentOn: html.

Admin_User_RecordSelector >>renderRowNumber: index item: row on: html

	"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
						renderColumn: ea
						row: row
						on: html]]

More information about the seaside mailing list