Thanks all,
Dave E
If you have some heavy server side operations/queries to render a page, you'd better try to find a solution to generate a cache on the server-side (or even a simple HTML file created by PHP/ASP) : easier to update/manage/upgrade/...
My 0,02€ is client side cache is good for CSS and template-medias but not for the content itself.
Remi
> --
>
> You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
> To post to this group, send email to iphone...@googlegroups.com.
> To unsubscribe from this group, send email to iphonewebdev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
>
>
Remi Grumeau
(+33) 663 687 206
http://www.remi-grumeau.com
Elements loaded via AJAX are not deleted unless they are refreshed by
another ajax load. When refreshed by another ajax load the old elements
are replaced by the new elements -- but only if they have the same 'id'
attribute. If you have a long-lived app with a lot of page-frags/views
being loaded you have a potential memory problem. To avoid this you'll
have to find a way to assign a unique id to each element that is
loaded. If it's content from a database you could generate the id from
the record id (e.g. id="widget4039") This will at least reduce the use
of DOM elements to unique records.
iUI could fairly easily be extended to unload DOM elements when no
longer needed (or even to use them as a client side cache) If you are
interested in doing that you should definitely start with the
development versions of iUI 0.40. There is an event mechanism to
support extensions that should make this feature fairly easy to
implement. It is something I would very much like to see. If someone
builds a nice extension with this feature I could easily see that
feature being migrated into the core.
-- Sean
Fortunately for me, my backend keeps track of the logical level that
the client is at by embedding a level parm into each link. It does
that so that it can generate unique ids for the results divs it
returns.
By capturing the aftertransition event I can run a script to delete
everything from the dom with a level number higher than whatever the
level of the target page is.
I am planning on caching the static stuff (css and scripts) via a
manifest once development is complete (or as complete as it's going to
be). My content is highly volatile and pretty much impossible to cache
although I am considering using a client side database to implement a
'more' function. Send all the data but only display say the first ten
rows, get the next ten from the internal db until user drills down to
next level up up to previous level. Can't do 'more' from the server
because of data volatility.
And to think I am doing this for 'fun!'
Thanks for you input,
Dave E
Anyway, I did some testing and it does not delete the old elements as
you say.
However my apps back end server keeps track of logical level of each
result set as you drill down by appending a parm to each link that
results in a call to it with the current level, then it adds one for
the next level etc.
it does this so that it can create unique ids for the divs in each
result set.
What I did was to use the logical level as a class and added an event
listener for the aftertransition event.
That listener get the class from the target page (event.out = false),
gets the class from it and finds the numeric one.
It then adds one to that value and does a delete of the elements with
that class (class from target page + 1) below the body element (which
is where iUI is attaching all the new divs).
When you are drilling down (increasing level number) the event code
does nothing because there's nothing there to delete. When you are
paging back using the back button the level number is decreasing so
it's continually deleting the previous levels data.
All bit of a fudge and not very generic but it does work.
-- Sean