Hello Aida community,
My apologies if my conclusions are not correct, I'm new to the Aida.
I stumbled at a situation which is better to describe by a simple
example. Counter seems like a good candidate.
Each time we press on a link ajax is fired and counter is incremented.
Whole application supposed to be redrawn.
| e link |
e := WebElement new.
link := e
addLinkTo: self observee
text: 'Counter: ' , counter displayString.
link onClickUpdate: self.
self method: #inc.
counter := 0.
counter := counter + 1.
The code doesn't work properly. The problem is that WebApplication
_id_ inside of WebApplication and in WebForm goes out of sync. So ajax
request go to illegal element. This happens because of WebApplication
clearing(WebApplication>>cleanup) at html printing nilify id inside of
WebApplication, and later WebApplication get generated id instead of
old one stored in the form.
My fix is pretty straitforward:
anElement id isNil ifTrue:
[(self isRegistered: anElement) ifTrue:
[^anElement id: (self ids keyAtValue: anElement)]. "Using of old key"
^anElement id: self nextId]. "auto id if not manually defined! "
Hope this can be useful,
Aida mailing list