[Seaside] liveAction using existing method

William E Harford seaside at harford.org
Thu Jun 30 02:48:58 CEST 2005


On Thu, 2005-06-30 at 00:58 +0200, Avi Bryant wrote:
> On 6/30/05, William E Harford <seaside at harford.org> wrote:
> 
> > I also simply tried using the WAHtmlRender object that is passed to
> > liveAction ...
> > 
> > html anchorWithAction: []
> >     liveAction:[:h |
> >     self showPatient: (row at: 'ionumber') .
> >     self renderPatientOn: fh.
> >     h divNamed:'patientContainer' with:fh.
> > ] text: (row at: 'lastname') .
> > 
> > When doing it that way liveAction insisted on changing a child div of
> > patientContainer and I figured that usage was incorrect.

Wooops The above should of read (error in transposing)

html anchorWithAction: [] 
    liveAction:[:h | 
    self showPatient: (row at: 'ionumber') .
    self renderPatientOn: h.
    h divNamed:'patientContainer' with:h.	
] text: (row at: 'lastname') .

No it does not work as expected and I figured out why ...

In renderContentOn: I had 

html divNamed: 'patientContainer' with: [
    self renderPatientOn: html.
].

After looking at the javaScript and particularly the liveUpdate
javaScript function processRequestChange() I discovered that it was
parsing out the first div id of the liveUpdate generated page (is that
the right terminology ? ). Or in other words I was trying to over
complicate things. 

The simple solution  was to move html divNamed: 'patientContainer' with:
[] to renderPatientOn, remove html divNamed: 'patientContainer' with: []
from renderContentOn and simply call the live action like so...

html anchorWithAction: [] 
    liveAction:[:h | 
    self showPatient: (row at: 'ionumber') .
    self renderPatientOn: h.
] text: (row at: 'lastname') .


Sometimes having a beer, a slice (or three) of pizza, and a little
pointing in the right direction helps tremendously :-) .

Now it updates the right div but for some reason row always contains a
Dictionary representing the last row. It is most likely a
misunderstanding on my part of how SmallTalk blocks work (I am new to
SmallTalk and I am never going back) but...

html anchorWithAction: [self showPatient: (row at: 'ionumber')] text:
(row at: 'lastname') .

Works fine (except the fact that is reloads the entire page of course).


Thanks
Will

> 
> Hi Will,
> 
> What you describe (simply using the WAHtmlRender object that's passed
> in) should be the right approach.  But that's not what your code above
> has.  It should just be:
> 
> html anchorWithAction: []
> liveAction: [:h |
>      self showPatient: (row at: 'ionumber') .
>      self renderPatientOn: h]
> text: (row at: 'lastname')
> 
> Does that not work?
> 
> Avi
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
> 




More information about the Seaside mailing list