code: function() {
              var $this = $(this);
              if ($this.treegrid('getSetting', 'saveStateMethod') === 'cookie') {
  
                  var stateArrayString = $.cookie($this.treegrid('getSetting', 'saveStateName')) || '';
                  var stateArray = (stateArrayString === '' ? [] : stateArrayString.split(','));
                  var nodeId = $this.treegrid('getNodeId');
  
                  if ($this.treegrid('isExpanded')) {
                      if ($.inArray(nodeId, stateArray) === -1) {
                          stateArray.push(nodeId);
                      }
                  } else if ($this.treegrid('isCollapsed')) {
                      if ($.inArray(nodeId, stateArray) !== -1) {
                          stateArray.splice($.inArray(nodeId, stateArray), 1);
                      }
                  }
                  $.cookie($this.treegrid('getSetting', 'saveStateName'), stateArray.join(','));
              }
              return $this;
          }
docs: Save state of current node
  
  @returns {Node}