protected boolean isInSameGroup(FacesContext context, DataTable component, int currentRowIndex, int step, ValueExpression groupByVE,
                                    boolean loadFirstRowOfNextPage) {
        ELContext elContext = context.getELContext();
        Object currentGroupByData = groupByVE.getValue(elContext);
        int nextRowIndex = currentRowIndex + step;
        Object nextGroupByData;

        // An additional check is required to ensure summaryRow will be rendered in case
        // number of rows of the current page is equals to the number of items in the current group (otherwise, it'll never be rendered)
        // see #9077
        if (loadFirstRowOfNextPage && component.isLazy()) {
            Object nextRowData = component.getLazyDataModel().loadOne(nextRowIndex, component.getActiveSortMeta(), component.getActiveFilterMeta());
            if (nextRowData == null) {
                return false;
            }

            nextGroupByData = ComponentUtils.executeInRequestScope(context, component.getVar(), nextRowData, () -> groupByVE.getValue(elContext));
        }
        else {
            component.setRowIndex(nextRowIndex);
            if (!component.isRowAvailable()) {
                component.setRowIndex(currentRowIndex); // restore row index
                return false;
            }

            nextGroupByData = groupByVE.getValue(elContext);
            component.setRowIndex(currentRowIndex); // restore row index
        }

        return Objects.equals(nextGroupByData, currentGroupByData);
    }
Encodes dynamic column. Allows to override default behavior.
primefaces/src/main/java/org/primefaces/component/datatable/DataTableRenderer.java