Solved

jsTree cookies not working

Posted on 2013-12-18
2
706 Views
Last Modified: 2013-12-18
I think this is my 3rd question about jsTree and everything is starting to work great.  I have the tree going but when I select a node and the page refreshes all the nodes are closed.

This is the script I use for the tree

<script type="text/javascript">
           var uid = <%=  ViewData["uid"] %>
          $(function() {          
              $("#categories").jstree(
          {
              "themes": {
                  "theme": "classic",
                  "dots": true,
                  "icons": true
              },
              "json_data": {
                  "ajax": {
                      "url": "/Home/GetEmployeeInfo/"   }
              },

              "core": { "initially_open": uid },
              "ui": { "select_limit": 1 },
              "cookies": {"auto_save": true },
              "plugins": ["themes", "json_data", "ui", "cookies", "types"]


          })

	.bind("select_node.jstree", function(e, data) {		   
	    window.location.href = '/Details/Index/' + data.rslt.obj.attr("id");
          	})

          });
        
    </script>

Open in new window


Thank you in advance for any help
0
Comment
Question by:Niall292
  • 2
2 Comments
 

Accepted Solution

by:
Niall292 earned 0 total points
ID: 39727470
Working with colleagues we still used cookies but also ajax and it worked great. So for anyone who might have the same problem here is what we did.

.bind("select_node.jstree", function(e, data) {		
            $.ajax({
                type:"GET",
                url:"/controller/action/" + data.rslt.obj.attr("id"),
                success: function(content) {
                    $("#content").html(content);
                }
            }); 

Open in new window

0
 

Author Closing Comment

by:Niall292
ID: 39727471
This was figured out with colleagues at work
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now