public/javascripts/yui/datatable/datatable.js
function(tree) {
            var maxRowDepth = 1;
            var currentRow;
            var currentColumn;

            // Calculate the max depth of descendants for this row
            var countMaxRowDepth = function(row, tmpRowDepth) {
                tmpRowDepth = tmpRowDepth || 1;

                for(var n=0; n<row.length; n++) {
                    var col = row[n];
                    // Column has children, so keep counting
                    if(YAHOO.lang.isArray(col.children)) {
                        tmpRowDepth++;
                        countMaxRowDepth(col.children, tmpRowDepth);
                        tmpRowDepth--;
                    }
                    // No children, is it the max depth?
                    else {
                        if(tmpRowDepth > maxRowDepth) {
                            maxRowDepth = tmpRowDepth;
                        }
                    }

                }
            };

            // Count max row depth for each row
            for(var m=0; m<tree.length; m++) {
                currentRow = tree[m];
                countMaxRowDepth(currentRow);

                // Assign the right ROWSPAN values to each Column in the row
                for(var p=0; p<currentRow.length; p++) {
                    currentColumn = currentRow[p];
                    if(!YAHOO.lang.isArray(currentColumn.children)) {
                        currentColumn._nRowspan = maxRowDepth;
                    }
                    else {
                        currentColumn._nRowspan = 1;
                    }
                }

                // Reset counter for next row
                maxRowDepth = 1;
            }
        }
function(tree) {
            var maxRowDepth = 1;
            var currentRow;
            var currentColumn;

            // Calculate the max depth of descendants for this row
            var countMaxRowDepth = function(row, tmpRowDepth) {
                tmpRowDepth = tmpRowDepth || 1;

                for(var n=0; n<row.length; n++) {
                    var col = row[n];
                    // Column has children, so keep counting
                    if(YAHOO.lang.isArray(col.children)) {
                        tmpRowDepth++;
                        countMaxRowDepth(col.children, tmpRowDepth);
                        tmpRowDepth--;
                    }
                    // No children, is it the max depth?
                    else {
                        if(tmpRowDepth > maxRowDepth) {
                            maxRowDepth = tmpRowDepth;
                        }
                    }

                }
            };

            // Count max row depth for each row
            for(var m=0; m<tree.length; m++) {
                currentRow = tree[m];
                countMaxRowDepth(currentRow);

                // Assign the right ROWSPAN values to each Column in the row
                for(var p=0; p<currentRow.length; p++) {
                    currentColumn = currentRow[p];
                    if(!YAHOO.lang.isArray(currentColumn.children)) {
                        currentColumn._nRowspan = maxRowDepth;
                    }
                    else {
                        currentColumn._nRowspan = 1;
                    }
                }

                // Reset counter for next row
                maxRowDepth = 1;
            }
        }
function ( tree ) { var maxRowDepth = 1 ; var currentRow ; var currentColumn ; // Calculate the max depth of descendants for this row var countMaxRowDepth = function ( row , tmpRowDepth ) { tmpRowDepth = tmpRowDepth || 1 ; for ( var n = 0 ; n < row . length ; n ++ ) { var col = row [ n ] ; // Column has children, so keep counting if ( YAHOO . lang . isArray ( col . children ) ) { tmpRowDepth ++ ; countMaxRowDepth ( col . children , tmpRowDepth ) ; tmpRowDepth -- ; } // No children, is it the max depth? else { if ( tmpRowDepth > maxRowDepth ) { maxRowDepth = tmpRowDepth ; } } } } ; // Count max row depth for each row for ( var m = 0 ; m < tree . length ; m ++ ) { currentRow = tree [ m ] ; countMaxRowDepth ( currentRow ) ; // Assign the right ROWSPAN values to each Column in the row for ( var p = 0 ; p < currentRow . length ; p ++ ) { currentColumn = currentRow [ p ] ; if ( ! YAHOO . lang . isArray ( currentColumn . children ) ) { currentColumn . _nRowspan = maxRowDepth ; } else { currentColumn . _nRowspan = 1 ; } } // Reset counter for next row maxRowDepth = 1 ; } }
Determine ROWSPAN value for each Column in the tree
Determine ROWSPAN value for each Column in the tree