title: Nestable plugin
body: <p><strong>SOLVED</strong></p>
  
  <p>I have one question.</p>
  
  <p>Is possible use Nestable jQuery Plugin with jQuery Cookie on "Expand" and "Collapse"?
  To remember "Expand" and "Collapse" position.</p>
  
  <p>Link to script: <a href="http://dbushell.com/2012/06/17/nestable-jquery-plugin/" rel="nofollow">Nestable jQuery Plugin</a></p>
  
  <p>Thanks for answer!</p>
  
  <p><strong>This is script with cookie save:</strong></p>
  
  <pre><code>expandItem: function(li)
      {
          li.removeClass(this.options.collapsedClass);
          li.children('[data-action="expand"]').hide();
          li.children('[data-action="collapse"]').show();
          li.children(this.options.listNodeName).show();
          if(getCookie("tree") != null){
              var CookieValue = getCookie("tree") + li.attr('data-id') + ",";
          }
          else{
              var CookieValue = li.attr('data-id') + ",";
          }
          $.cookie("tree", CookieValue, {expires:3600, path:'/administrator/'});
      },
  
      collapseItem: function(li, a)
      {
          var lists = li.children(this.options.listNodeName);
          if (lists.length) {                
              li.addClass(this.options.collapsedClass);
              li.children('[data-action="collapse"]').hide();
              li.children('[data-action="expand"]').show();
              li.children(this.options.listNodeName).hide();
              if(getCookie("tree") != null){
                  var CookieValueArray = getCookie("tree").split(",");
                  for(i=0;i&lt;CookieValueArray.length;i++){
                      if(CookieValueArray[i] == li.attr('data-id') &amp;&amp; a == true){
                          li.children('[data-action="expand"]').hide();
                          li.children('[data-action="collapse"]').show();
                          li.children(this.options.listNodeName).show();
                      }
                  }
                  if(a != true){
                      var CookieValue = "";
                      for(i=0;i&lt;CookieValueArray.length-1;i++){
                          if(CookieValueArray[i] != li.attr('data-id')){
                              CookieValue += CookieValueArray[i] + ",";
                          }
                      }
                      if(CookieValue == ""){
                          $.cookie("tree", "", {expires:-1, path:'/administrator/'});
                      }
                      else{
                          $.cookie("tree", CookieValue, {expires:3600, path:'/administrator/'});
                      }
                  }
              }
          }
      },
  </code></pre>