src/sap.ui.commons/src/sap/ui/commons/Tree.js
function rememberSelectedChildren(oNode, oRootNode) {
		var aNodes = oNode._getNodes(),
			oCurrentNode;

		for (var i = 0; i < aNodes.length; i++) {
			oCurrentNode = aNodes[i];

			if (oCurrentNode.getIsSelected()) {
				oRootNode.addAssociation("selectedForNodes", oCurrentNode, true);
			}

			rememberSelectedChildren(oCurrentNode, oRootNode);
		}
	}
function rememberSelectedChildren(oNode, oRootNode) {
		var aNodes = oNode._getNodes(),
			oCurrentNode;

		for (var i = 0; i < aNodes.length; i++) {
			oCurrentNode = aNodes[i];

			if (oCurrentNode.getIsSelected()) {
				oRootNode.addAssociation("selectedForNodes", oCurrentNode, true);
			}

			rememberSelectedChildren(oCurrentNode, oRootNode);
		}
	}
function rememberSelectedChildren ( oNode , oRootNode ) { var aNodes = oNode . _getNodes ( ) , oCurrentNode ; for ( var i = 0 ; i < aNodes . length ; i ++ ) { oCurrentNode = aNodes [ i ] ; if ( oCurrentNode . getIsSelected ( ) ) { oRootNode . addAssociation ( "selectedForNodes" , oCurrentNode , true ) ; } rememberSelectedChildren ( oCurrentNode , oRootNode ) ; } }
Adds references inside the collapsed node of all its selected children recursively.
@param {sap.ui.commons.TreeNode} oNode The current node to look at
@param {sap.ui.commons.TreeNode} oRootNode The root node that was collapsed
Adds references inside the collapsed node of all its selected children recursively .