js/jquery.treegrid.js
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;
        }
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;
        }
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 ; }
Save state of current node

@returns {Node}
Save state of current node