I was wondering what you think a good approach might be to persisting the state of the tree (expanded/collapsed) across page reloads. I was thinking that perhaps a good way would be to write the full HTML off to a cookie, but cookies have size limitations, which very big trees could theoretically exceed, especially if people theme in some new classes, etc.

Another option would be to make an AJAX request on every click to save the state into the session, but that might slow everything down and increase the server hits somewhat substantially.

Perhaps a hybrid approach is to only save the tree state when someone is about to navigate away (document.onunload? Is there such a thing?), then just make that one last JS request.

Then in the theme function that's generating the HTML it could check the session object first to see if there's already a state saved?

I've got a client who will pay for me to code this, but I want to do it in a way that you will accept. Also, I wanted to do a sanity check that someone else hasn't already done this.

Thanks!

Comments

xano’s picture

Project: Vocabulary Index » Index
Version: 6.x-2.2 » 6.x-1.x-dev
Component: User interface » Display modes
Status: Active » Postponed (maintainer needs more info)

What you want collides with #350509: Expand active links in tree view and at this moment I'm more tempted to add that feature than to add this one. Please realise that Vocabulary Index will be succeeded by Index, which works with more than just Taxonomy entities.

xano’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

No response for three months and it collides with #350509: Expand active links in tree view.

chrisfromredfin’s picture

Sorry, I didn't reply because I agreed. :)