[aida] Aida 6.4 problem with Ajax HTML5 based application

Janko Mivšek janko.mivsek at eranova.si
Tue Jul 31 14:12:18 CEST 2012


Hi Martin,

This is my first guess: try to init widget event handlers at the start
of widget build method:

 aWidget>>#build
 	self initEventHandlers
	....

But maybe even better would be to put #initEventHandlers in #clear
method, I suppose. #Clear is then called from Ajax called #rebuild, but
you can call it manually as well. Would you experiment a bit with that idea?

Best regards
Janko
	

Dne 31. 07. 2012 13:52, piše Martin Polák:
> Hello list,
> 
> I have tried to overpass the problem described in my last post. I have created an instance variable, which holds the instance of my widget. It works and prevents from increasing the number of instances of this widget, but another problem occurs here. I have following code:
> 	
> 	(e addNilLinkText: 'Add') onClickDo: [self expenseWidget isNew: true; onAnswerDo: [:newExpense | self observee addExpense: newExpense. anElement update]]; onClickPopup: self expenseWidget.
> 
> which works, but every time a webpage is refreshed in browser, onAnswerDo: block is added to the widget again, so after for example 5 refreshes, after I click Save button on widget, it fires that block 5 times, so I have 5 identical records in database. I think, it's because of #addActionBlock: method of WebEventHandler, but I'm not sure, if I can safely change it to hold only the last block (probably it will break some other things in Aida, I'm not expert here ;)). Anyone with some suggestion please?
> 
> Cheers Martin
> 
> 
> 27. 7. 2012 v 17:06, Martin Polák <nigol na nigol.cz>:
> 
>> Hi Janko,
>>
>> I discovered strange behavior with application I'm writing now. I'm using similar technique as in ToDo example to show up dialogs and so on. Let me say, I have:
>>
>> 	(e addNilLinkText: 'Categories') onClickPopup: (ENCategoriesListWidget new).
>>
>> which creates new ENCategoriesListWidget instance and then show it up. After clicking on Close button in that dialog, it disappear as expected. This work well. But the created instance of ENCategoriesListWidget keeps allocated somewhere in memory so it takes some space. And when you work in application, memory keeps filling with those instances and after 2 days, my application had eaten all reserved memory on server and crashed down. What could be wrong? Same problem is with ToDo example (try create some tasks and discover created instances: ToDoTaskWidget instanceCount it keeps to increase). I'm planning to add instance variable to WebSession, which will hold ENCategoriesListWidget and use it in onClickPopup: instead of creating new instance every time. Do you think, it will help? I'm using Pharo 1.3.
>>
>> Martin
>> _______________________________________________
>> Aida mailing list
>> Aida na aidaweb.si
>> http://lists.aidaweb.si/mailman/listinfo/aida
> 
> _______________________________________________
> Aida mailing list
> Aida na aidaweb.si
> http://lists.aidaweb.si/mailman/listinfo/aida
> 

-- 
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565




More information about the Aida mailing list