code: function collectHeaderSpans(oColumn, index, aCols) {
  			var colSpan = TableUtils.Column.getHeaderSpan(oColumn, iRow),
  				iColIndex;
  
  			if (nSpan < 1) {
  				if (colSpan > 1) {
  					// In case when a user makes some of the underlying columns invisible, adjust colspan
  					iColIndex = oColumn.getIndex();
  					colSpan = aCols.slice(index + 1, index + colSpan).reduce(function(span, column){
  						return column.getIndex() - iColIndex < colSpan ? span + 1 : span;
  					}, 1);
  				}
  
  				oColumn._nSpan = nSpan = colSpan;
  				iLastVisibleCol = index;
  			} else {
  				//Render column header but this is invisible because of the previous span
  				oColumn._nSpan = 0;
  			}
  			nSpan--;
  		}
docs: collect header spans and find the last visible column header