Solved

jsTree cookies not working

Posted on 2013-12-18
2
721 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

778 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