Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6619831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:01:20+00:00 2026-05-25T21:01:20+00:00

I have a tree view menu in ruby. I am expanding the tree and

  • 0

I have a tree view menu in ruby.
I am expanding the tree and it works well.
On refreshing the page it collapsesand my expansion is not seen.
Please let me know if there is a way to rember the state of the tree view.

my view code:

%table.treeTable
%thead
%th
  All:
  = link_to "Expand", "#", :class => "all_action_expand"
  = "/"
  = link_to "Collapse", "#", :class => "all_action_collapse"
%th
  = link_to "Check", "#", :class => "check_all"
  = "/"
  = link_to "Uncheck", "#", :class => "uncheck_all"


%tbody 
- Ic.make_tree(@ics).values.each do |root|
  %tr{:id => root.tree_id, :class => "root"}
    %td= root.root_name
    - if show_check_boxes
      %td= check_box_tag "ic_glob", root.tree_id, false, :class => "ic_parent"
  - root.suites.each do |suite|
    %tr{:id => suite.tree_id, :class => "child-of-#{root.tree_id}"}
      %td= suite.suite_name
      - if show_check_boxes
        %td= check_box_tag "ic_glob", suite.tree_id, false, :class => "ic_parent"
    - suite.children.each do |case_item|
      %tr{:id => case_item.tree_id, :class => "child-of-#{suite.tree_id}"}
        %td= case_item.case_name
        - if show_check_boxes
          %td= check_box_tag "ic_glob", case_item.tree_id, false, :class => "ic_parent"
      - case_item.children.each do |ic|
        %tr{:id => ic.id, :class => "child-of-#{case_item.tree_id}"}
          %td= link_to ic.name, edit_ic_path(ic.id)
          - if show_check_boxes
            %td= check_box_tag "ic_ids[]", ic.id, false
  /Execute the tree table javascript (hackish)
  = javascript_tag "$('.treeTable').treeTable({persist:true})"
  / Need some Ic javascript to (cascading selects, etc.)
  = javascript_include_tag "pages/ic"
  = javascript_include_tag "jquery.cookie"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:01:20+00:00Added an answer on May 25, 2026 at 9:01 pm

    You can use a cookie to store the actual state of your tree. When you reload the page, read the cookie and restore the expansion.

    EDIT:

    You need the jquery-cookie plugin, then use the persist parameter to restore the tree expansions after reload automagically:

    $(".example").treeTable({
      persist: true
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Tree View as a main menu. After program start, I add
I have a tree view <asp:TreeView ID=TreeView1 runat=server DataSourceID=SiteMapDataSource1 ShowExpandCollapse=False> </asp:TreeView> As you can
I have a tree view defined as follows: <HierarchicalDataTemplate x:Key=ChildTemplate ItemsSource={Binding Children}> <TextBlock Text={Binding
I have a hypothetical tree view that contains this data: RootNode Leaf vein SecondRoot
I have a web application where I am using asp.net tree view control to
I have three tree view controls which house different (but mostly similar data), as
I have a tree view on the left side. Selecting a node displays relevant
I have 2 forms (2 windows). In first window,I have a tree view (the
I have a tree-view and datagridview on my form. I will have an import
I have an ASP.NET MVC page that has left Menu Navigation that is built

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.