Squeak issue with onClickDo: aBlock andUpdate: anElement

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Squeak issue with onClickDo: aBlock andUpdate: anElement

Herbert König
Hi,

trying to make WebElement>>onClickDo: aBlock andUpdate: anElement
work for me I found that it doesn't update some elements because they
are not registered yet.

In a view I have two reusable components. If I click on one a WebGrid
it ultimately should update itself and another component. While I can
make it update itself I couldn't make it update the other component as
an alternative.

The reason turned out to be that the other component had no ID yet.

So registering the other component before using it in
onClickDo: aBlock andUpdate: anElement makes it update.

Can someone verify this in VW?

Code is like:
viewMain

  |e component1|
  e := Webelement new.
  component1 := e add: self displayComponent1
  e add: self displayComponent2: component1
  self pageFrameWith: e title: test

displayComponent2 needs to know about displayComponent1 to update it
in its onClickDo:andUpdate

displayComponent1
  | e |
  e := WebElement new.
  (e newCell) addText: self observee string1;
              addNbSp: 3.
  (e newCell) addText: self observee string2.
  ^e

displayComponent2: componentToUpdate
  | e |
  componentToUpdate registerId. "This is crucial"
  e := WebGrid new.
  e columNames: ....;
    collection: ....;
    rowGreenIfTrue: [];      "This is why later I have to update myself"
    column: 2 addBlock:
                [:each| (WebText new text: self observee string3)
                    addBlock:
                       [self observee string1: each string2] fixTemps  "Squeaky"
                    andUpdate: displayComponent1
                ]
  ^e  

With this working I will now write
WebElement>>addBlock:andUpdateMany: aCollectionOfWebElements
as an experiment and see how it is useful.

 
Cheers,

Herbert                          mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida