On Aug 15, 5:42 pm, finneycanhelp <[email protected]> wrote:
> Some options are available here to meet these requirements.
>
> - For showing the list and hiding Add Names when list size = Count,
> should one:
> Store the Sample List into something globally accessible in the page
> OR request the list each time something about the list is needed
> (size, content)
> OR ....
> What is the simplest and cleanest approach?
>
> BTW, the list is requested each time an item is added or removed right
> now. It seems easier to debug that way.

i think that conceptually you're trying to do something like i
recently did for an app. It wasn't a list of names, but a list of
cybertanks for a wargame i like to play. In that app (http://
wanderinghorse.net/gaming/ogre/byoo/ajax/) i did the following (that's
not to imply that this is "simplest" or "cleanest"):

At startup, i load all of the app data (a bit over 100kb) into the
client. It is transfered as JSON and then transformed to higher-level
app objects. However, i keep the original JSON db around, partly so
that i can figure out if a user has modified an object (i.e. if it
needs saving) and partly to implement a "revert changes" option
without having to request the data again. When the user uses "save",
we convert the high-level app object to JSON, update the local
internal copy of the JSON data, and send it off to the server.

For really large data sets i wouldn't keep the whole thing in memory,
but this particular app is intended to be a "rich client", and not
just page dressing, so i wasn't too concerned about memory usage.
However, i am considering re-modeling it to request data only as
needed. i think the determining factory here is how much traffic (and
request count) i save using one approach or the other. i haven't
analyzed that yet, so i can't yet make an informed decision.

Maybe poking around the above app with firebug would prove
informative. Feel free to use the editing features (they're open to
all w/o any sort of login) - you can then watch the json transactions
using firebug.

Reply via email to