InfiniteLoop has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks,
I ask this question in little trepidation. This is not entirely related to perl. Since I use perl to generate this, I feel I can ask this question here.

For my latest project, Im using Apache + mod_per. Im also using CGI::Application with Html::Template for a proper MVC architecture. One of the commonly repeating page is a tree view. This tree is generated via asynchronous javascript call to the server.

This in itself is smooth and fast. However, I need to retain the user expanded tree view, when the page reloads (may be because the user has submitted the parent page etc). I tried to solve this by storing the expanded section's id in a cookie and while re-generating the tree view, I check the sections against the id's stored in the cookie and expand those. But this turned out to be slow. Can any one point me in the right direction to solve this problem ?

Replies are listed 'Best First'.
Re: tree view control, html
by sauoq (Abbot) on Sep 16, 2005 at 22:50 UTC
    I tried to solve this by storing the expanded section's id in a cookie and while re-generating the tree view, I check the sections against the id's stored in the cookie and expand those. But this turned out to be slow.

    Have you tried to determine why it is slow? If the tree isn't particularly big—and I'm guessing it can't be if it is to remain useful to the user—then it would be hard to imagine this being noticeably slow. It's not like it would require any heavy computation.

    One suggestion I'd make, though not for reasons of efficiency, would be to store your section IDs locally (i.e. in a session) and then pass only the key to the session via the cookie. Putting lots of stuff in cookies isn't scalable.

    -sauoq
    "My two cents aren't worth a dime.";