WebGrid and object instances.

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

WebGrid and object instances.

Nicholas Moore

I think this is worth a new thread (Thanks for your earlier response Herbert).

My directory listing works very well, the Aida ajax calls allow me to have a nice display of names and show a selected entry details alongside the list of names. It is likely that a user will have the page open for a while and look at a series of entries.

After a while there will be a few thousand WebText elements. The behaviour is not 100% consistent but in general I have to manually remove the instance of my app and then do initAppsForObjects for the session and then do a gc in order to remove them. Sometimes I have to do this twice.

It is not clear to me whether it is the context or the app (or the session) which is being held onto.

As a test I have tried sub-classing 'webAppFor' in the apps observee and modifying it so that it always creates a new app when the page is refreshed - this works well with respect to releasing the Text objects, but of course the app loses all context etc for the ajax calls and the request headers.

Any suggestions appreciated.

Here are the guts of my viewMain:

viewMain

| e displaySelected grid |

self clear.

self title: 'Community Drectory'.

e := WebElement newClass: #condiv.

displaySelected := self display.

grid := WebGrid new.

grid columnNames: #('' 'Name' 'Phone' );

setNumbering;

columnWidth: #(15 250 100);

columnFilters: #(nil true true);

sortOn: 2;

collection: self observee directory;

columnAspects: #(nil #name #defaultPhone);

column: 2

addBlock: [:each | (WebText new text: each name)

onClickDo: [selectedEntry := each] fixTemps

andUpdateMany:

(OrderedCollection with: grid with:displaySelected with: (self colourGrid: grid))].

e cell add: grid.

(e newCell class: #mSelectedDisplay) add: displaySelected.

Nicholas


--

Nicholas Moore
Limoges

France


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebGrid and object instances.

Janko Mivšek
Hi Nicholas,

I'd add paging and column filters for quick filtering down the persons.
WebGrid filters are something my customers love the most.

Janko

Nicholas Moore pravi:

> I think this is worth a new thread (Thanks for your earlier response
> Herbert).
>
> My directory listing works very well, the Aida ajax calls allow me to
> have a nice display of names and show a selected entry details alongside
> the list of names. It is likely that a user will have the page open for
> a while and look at a series of entries.
>
> After a while there will be a few thousand WebText elements. The
> behaviour is not 100% consistent but in general I have to manually
> remove the instance of my app and then do initAppsForObjects for the
> session and then do a gc in order to remove them. Sometimes I have to do
> this twice.
>
> It is not clear to me whether it is the context or the app (or the
> session) which is being held onto.
>
> As a test I have tried sub-classing 'webAppFor' in the apps observee and
> modifying it so that it always creates a new app when the page is
> refreshed - this works well with respect to releasing the Text objects,
> but of course the app loses all context etc for the ajax calls and the
> request headers.
>
> Any suggestions appreciated.
>
> Here are the guts of my viewMain:
>
> viewMain
>
> | e displaySelected grid |
>
> self clear.
>
> self title: 'Community Drectory'.
>
> e := WebElement newClass: #condiv.
>
> displaySelected := self display.
>
> grid := WebGrid new.
>
> grid columnNames: #('' 'Name' 'Phone' );
>
> setNumbering;
>
> columnWidth: #(15 250 100);
>
> columnFilters: #(nil true true);
>
> sortOn: 2;
>
> collection: self observee directory;
>
> columnAspects: #(nil #name #defaultPhone);
>
> column: 2
>
> addBlock: [:each | (WebText new text: each name)
>
> onClickDo: [selectedEntry := each] fixTemps
>
> andUpdateMany:
>
> (OrderedCollection with: grid with:displaySelected with: (self
> colourGrid: grid))].
>
> e cell add: grid.
>
> (e newCell class: #mSelectedDisplay) add: displaySelected.
>
> Nicholas
>
>
> --
>
> Nicholas Moore
> Limoges
>
> France
--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebGrid and object instances.

Janko Mivšek
Hi Nicholas,

Nicholas Moore pravi:

> I already have columnFilters: - which I like and work nicely. I have
> added rowsOnPage: 20; but only get the first page - selecting a
> different page number has no effect.
>
> Neither of them seem to have affected the way instances of WebText stay
> in the image.

Ok, I think I know the reason. While Ajax updating your grid and other
elements your WebText ids are registered in contexts but old ones are
not released. That's why those instances are growing and growing. To
check that, look at your app contexts instvar.

Why old ids are not released? Well, it is a bit hard to know, when they
won't be used for sure anymore. This is an old problem but I hope with
contexts we'll solve it somehow.

Best regards
Janko


>
> Nicholas
>
> On Tuesday 07 July 2009 19:28:55 you wrote:
>
>> Hi Nicholas,
>
>>
>
>> I'd add paging and column filters for quick filtering down the persons.
>
>> WebGrid filters are something my customers love the most.
>
>>
>
>> Janko
>
>>
>
>> Nicholas Moore pravi:
>
>> > I think this is worth a new thread (Thanks for your earlier response
>
>> > Herbert).
>
>> >
>
>> > My directory listing works very well, the Aida ajax calls allow me to
>
>> > have a nice display of names and show a selected entry details alongside
>
>> > the list of names. It is likely that a user will have the page open for
>
>> > a while and look at a series of entries.
>
>> >
>
>> > After a while there will be a few thousand WebText elements. The
>
>> > behaviour is not 100% consistent but in general I have to manually
>
>> > remove the instance of my app and then do initAppsForObjects for the
>
>> > session and then do a gc in order to remove them. Sometimes I have to do
>
>> > this twice.
>
>> >
>
>> > It is not clear to me whether it is the context or the app (or the
>
>> > session) which is being held onto.
>
>> >
>
>> > As a test I have tried sub-classing 'webAppFor' in the apps observee and
>
>> > modifying it so that it always creates a new app when the page is
>
>> > refreshed - this works well with respect to releasing the Text objects,
>
>> > but of course the app loses all context etc for the ajax calls and the
>
>> > request headers.
>
>> >
>
>> > Any suggestions appreciated.


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebGrid and object instances.

Nicholas Moore

Yes, I think the solution lies in the way that a context does or does not release the WebText instances. Interestingly I do not get the same build up of other elements. I will be travelling for the next couple of weeks, but will investigate as soon as I can and let you know.

Nicholas

On Tuesday 07 July 2009 22:59:48 Janko Mivšek wrote:

> Hi Nicholas,

>

> Nicholas Moore pravi:

>

> > I already have columnFilters: - which I like and work nicely. I have

> > added rowsOnPage: 20; but only get the first page - selecting a

> > different page number has no effect.

> >

> > Neither of them seem to have affected the way instances of WebText stay

> > in the image.

>

> Ok, I think I know the reason. While Ajax updating your grid and other

> elements your WebText ids are registered in contexts but old ones are

> not released. That's why those instances are growing and growing. To

> check that, look at your app contexts instvar.

>

> Why old ids are not released? Well, it is a bit hard to know, when they

> won't be used for sure anymore. This is an old problem but I hope with

> contexts we'll solve it somehow.

>

> Best regards

> Janko

>

>

> >

> > Nicholas

> >

> > On Tuesday 07 July 2009 19:28:55 you wrote:

> >

> >> Hi Nicholas,

> >

> >>

> >

> >> I'd add paging and column filters for quick filtering down the persons.

> >

> >> WebGrid filters are something my customers love the most.

> >

> >>

> >

> >> Janko

> >

> >>

> >

> >> Nicholas Moore pravi:

> >

> >> > I think this is worth a new thread (Thanks for your earlier response

> >

> >> > Herbert).

> >

> >> >

> >

> >> > My directory listing works very well, the Aida ajax calls allow me to

> >

> >> > have a nice display of names and show a selected entry details alongside

> >

> >> > the list of names. It is likely that a user will have the page open for

> >

> >> > a while and look at a series of entries.

> >

> >> >

> >

> >> > After a while there will be a few thousand WebText elements. The

> >

> >> > behaviour is not 100% consistent but in general I have to manually

> >

> >> > remove the instance of my app and then do initAppsForObjects for the

> >

> >> > session and then do a gc in order to remove them. Sometimes I have to do

> >

> >> > this twice.

> >

> >> >

> >

> >> > It is not clear to me whether it is the context or the app (or the

> >

> >> > session) which is being held onto.

> >

> >> >

> >

> >> > As a test I have tried sub-classing 'webAppFor' in the apps observee and

> >

> >> > modifying it so that it always creates a new app when the page is

> >

> >> > refreshed - this works well with respect to releasing the Text objects,

> >

> >> > but of course the app loses all context etc for the ajax calls and the

> >

> >> > request headers.

> >

> >> >

> >

> >> > Any suggestions appreciated.

>

>


--

Nicholas Moore
Limoges

France


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebGrid and object instances.

Herbert König
In reply to this post by Nicholas Moore
Hi Nicholas,

NM> I think this is worth a new thread (Thanks for your earlier response Herbert).

definitely. Garbage collected late or never is a topic that also came
up in the discussions with Alex and seems not easily solved.

NM> My directory listing works very well, the Aida ajax calls
NM> allow me to have a nice display of names and show a selected entry
NM> details alongside the list of names. It is likely that a user will
NM> have the page open for a while and look at a series of entries.

After having fiddled with javascript and in the course having read
articles about js I came to the following opinion about how this
should work:

The server should create a WebGrid once, id's callbacks, texts and
all. The texts for the elements of the grid should be changed in the
html by javascript which gets sent new texts (maybe in JSON).

The server should know the index of the first row displayed in the
array and thus would know what a click on any element means.

Displaying the next page would just send the changed texts to
javascript which updates the texts in the html, keeping id and
callback. The server would just need to know the new index.

Same mechanism is employed with the display of the single address.
Replacing with a new clicked address means sending JSON to the browser
where js changes the html. ID's and callbacks stay the same.

Please note that this may be completely against AIDA philosophy.
I must think more clearly about it, learn more about current
implementation and we should ask Janko for his opinion.

I don't believe we should change WebGrid but for highly dynamical
applications build new elements where we don't send the complete
html, id's, callbacks if we update an element.

Maybe that is also the gist of Jaroslav's single page components which
I didn't look into yet.

BTW links would cause problems because two browser tabs might display
the same page. Jaroslav mentioned this imho. Much to think about.


Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: WebGrid and object instances.

Herbert König
Hi,


HK> I don't believe we should change WebGrid but for highly dynamical
HK> applications build new elements where we don't send the complete
HK> html, id's, callbacks if we update an element.

just employed firebug's network tool to see that WebGrid transfers
quite a lot of data if you sort or filter columns.

Then I went to deensoft, the makers of protochart and played with
their interactive charts. They transfer not a single byte if you
change the type of chart or zoom. Blazing fast as long as I don't use
IE.

Now I know what I'm aiming for :-))



Cheers,

Herbert                            mailto:[hidden email]

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