Solved

jsTree cookies not working

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host asp.net pages 5 25
ASP.NET Core index.html  LOCALHOST page cannot be found 2 22
Turn on intranet settings 1 36
Message not shown 5 29
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
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…

930 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

10 Experts available now in Live!

Get 1:1 Help Now