private function groupCells()
{
if (($columns = $this->_allColumns) === null) {
return;
}
$items = $this->getItems();
foreach ($columns as $id => $column) {
if (!$column->getEnableCellGrouping()) {
continue;
}
$prevCell = null;
$prevCellText = null;
foreach ($items as $item) {
$itemType = $item->getItemType();
$cell = $item->getCells()->itemAt($id);
if (!$cell->getVisible()) {
continue;
}
if ($itemType === TListItemType::Item || $itemType === TListItemType::AlternatingItem || $itemType === TListItemType::SelectedItem) {
if (($cellText = $this->getCellText($cell)) === '') {
$prevCell = null;
$prevCellText = null;
continue;
}
if ($prevCell === null || $prevCellText !== $cellText) {
$prevCell = $cell;
$prevCellText = $cellText;
} else {
if (($rowSpan = $prevCell->getRowSpan()) === 0) {
$rowSpan = 1;
}
$prevCell->setRowSpan($rowSpan + 1);
$cell->setVisible(false);
}
}
}
}
}