Row Selection
Live example
Section titled “Live example”Select task rows with the left checkboxes, then compare single-task and multi-task hierarchy actions. The pinned add-task draft has no task-selection checkbox.
Source code
import '@revolist/ui/styles.scss';import { createControl } from '@revolist/ui';import './gantt-showcase.scss';import { defineCustomElements } from '@revolist/revogrid/loader';defineCustomElements();
import { GanttPlugin } from '@revolist/gantt';import { ExportExcelPlugin, RowStatusPlugin } from '@revolist/revogrid-pro';import { STANDARD_CALENDAR, SHOWCASE_ASSIGNMENTS, SHOWCASE_BASELINES, SHOWCASE_COLUMNS_WITH_COMPLETION, SHOWCASE_DEFAULT_HIDDEN, SHOWCASE_DEPENDENCIES, SHOWCASE_GANTT_CONFIG, SHOWCASE_RESOURCES, SHOWCASE_TASKS, renderShowcaseTaskBarColor, renderShowcaseTaskBarContent,} from '../shared/gantt-project-data';import { currentTheme } from '../../composables/useRandomData';
// ─── Entry point ──────────────────────────────────────────────────────────────
export function load(parentSelector: string): void { const parent = document.querySelector(parentSelector); if (!parent) return; const darkTheme = currentTheme().isDark();
const container = document.createElement('div'); container.className = `gantt-showcase-shell grow h-full ${darkTheme ? 'gantt-showcase-shell--dark' : 'gantt-showcase-shell--light'}`; parent.appendChild(container);
const grid = document.createElement('revo-grid') as HTMLRevoGridElement; const controls = document.createElement('div'); controls.className = 'gantt-showcase-controls'; container.appendChild(controls);
grid.theme = darkTheme ? 'darkCompact' : 'compact'; grid.readonly = false; grid.range = true; grid.resize = true; grid.rowSize = 42; grid.rowHeaders = false; grid.hideAttribution = true; grid.autoSizeColumn = false; grid.classList.add('gantt-showcase-grid'); grid.plugins = [GanttPlugin, ExportExcelPlugin, RowStatusPlugin]; grid.hideColumns = [...SHOWCASE_DEFAULT_HIDDEN]; grid.columns = [...SHOWCASE_COLUMNS_WITH_COMPLETION]; grid.source = [...SHOWCASE_TASKS]; grid.ganttDependencies = [...SHOWCASE_DEPENDENCIES]; grid.ganttCalendars = [{ ...STANDARD_CALENDAR }]; grid.ganttResources = [...SHOWCASE_RESOURCES]; grid.ganttAssignments = [...SHOWCASE_ASSIGNMENTS]; grid.ganttBaselines = [...SHOWCASE_BASELINES]; let showCriticalPath = Boolean( SHOWCASE_GANTT_CONFIG.visuals.showCriticalPath, ); let showBaseline = false;
function applyGanttConfig() { grid.gantt = { ...SHOWCASE_GANTT_CONFIG, visuals: { ...SHOWCASE_GANTT_CONFIG.visuals, showCriticalPath, showBaseline, taskBarColorHook: renderShowcaseTaskBarColor, taskBarContentHook: renderShowcaseTaskBarContent, }, } as typeof grid.gantt; }
function createToggle( label: string, checked: () => boolean, onChange: (value: boolean) => void, ) { const control = createControl(document, 'button', { class: 'rv-btn-sm' }); control.textContent = label; const sync = () => { control.setAttribute('aria-pressed', String(checked())); control.classList.toggle('rv-btn-primary', checked()); }; control.addEventListener('click', () => { onChange(!checked()); applyGanttConfig(); sync(); }); sync(); return control; }
controls.append( createToggle( 'Critical path', () => showCriticalPath, (value) => { showCriticalPath = value; }, ), createToggle( 'Baselines', () => showBaseline, (value) => { showBaseline = value; }, ), );
applyGanttConfig(); container.appendChild(grid);}import '@revolist/ui/styles.scss';import { ButtonControl as UiButton } from '@revolist/ui/react-control';import './gantt-showcase.scss';import React, { useMemo, useRef, useState } from 'react';import { RevoGrid } from '@revolist/react-datagrid';import { GanttPlugin } from '@revolist/gantt';import { ExportExcelPlugin, RowStatusPlugin } from '@revolist/revogrid-pro';import { STANDARD_CALENDAR, SHOWCASE_ASSIGNMENTS, SHOWCASE_BASELINES, SHOWCASE_COLUMNS_WITH_COMPLETION, SHOWCASE_DEFAULT_HIDDEN, SHOWCASE_DEPENDENCIES, SHOWCASE_GANTT_CONFIG, SHOWCASE_RESOURCES, SHOWCASE_TASKS, renderShowcaseTaskBarColor, renderShowcaseTaskBarContent,} from '../shared/gantt-project-data';import type { GanttPluginConfig } from '@revolist/gantt';import { currentTheme } from '../../composables/useRandomData';
const plugins = [GanttPlugin, ExportExcelPlugin, RowStatusPlugin];const source = [...SHOWCASE_TASKS];const dependencies = [...SHOWCASE_DEPENDENCIES];const calendars = [{ ...STANDARD_CALENDAR }];const resources = [...SHOWCASE_RESOURCES];const assignments = [...SHOWCASE_ASSIGNMENTS];const baselines = [...SHOWCASE_BASELINES];const columns = [...SHOWCASE_COLUMNS_WITH_COMPLETION];const hiddenColumns = [...SHOWCASE_DEFAULT_HIDDEN];
function GanttShowcase() { const { isDark } = currentTheme(); const darkTheme = isDark(); const gridRef = useRef<HTMLRevoGridElement>(null); const [showCriticalPath, setShowCriticalPath] = useState( Boolean(SHOWCASE_GANTT_CONFIG.visuals.showCriticalPath), ); const [showBaseline, setShowBaseline] = useState(false); const ganttConfig: GanttPluginConfig = useMemo( () => ({ ...SHOWCASE_GANTT_CONFIG, visuals: { ...SHOWCASE_GANTT_CONFIG.visuals, showCriticalPath, showBaseline, taskBarColorHook: renderShowcaseTaskBarColor, taskBarContentHook: renderShowcaseTaskBarContent, }, }) as GanttPluginConfig, [showCriticalPath, showBaseline], );
return ( <div className={`gantt-showcase-shell grow h-full ${darkTheme ? 'gantt-showcase-shell--dark' : 'gantt-showcase-shell--light'}`} > <div className="gantt-showcase-controls"> <UiButton className={`rv-btn-sm ${showCriticalPath ? 'rv-btn-primary' : ''}`} aria-pressed={showCriticalPath} onClick={() => setShowCriticalPath((value) => !value)} > Critical path </UiButton> <UiButton className={`rv-btn-sm ${showBaseline ? 'rv-btn-primary' : ''}`} aria-pressed={showBaseline} onClick={() => setShowBaseline((value) => !value)} > Baselines </UiButton> </div> <RevoGrid ref={gridRef} className="gantt-showcase-grid" theme={darkTheme ? 'darkCompact' : 'compact'} hideAttribution readonly={false} range resize rowSize={42} rowHeaders={false} autoSizeColumn={false} plugins={plugins} hideColumns={hiddenColumns} source={source} columns={columns} gantt={ganttConfig} ganttDependencies={dependencies} ganttCalendars={calendars} ganttResources={resources} ganttAssignments={assignments} ganttBaselines={baselines} /> </div> );}
export default GanttShowcase;<template> <div :class="shellClass"> <div class="gantt-showcase-controls"> <button v-rv-control class="rv-btn rv-btn-sm" :class="{ 'rv-btn-primary': showCriticalPath }" :aria-pressed="showCriticalPath" @click="showCriticalPath = !showCriticalPath" > Critical path </button> <button v-rv-control class="rv-btn rv-btn-sm" :class="{ 'rv-btn-primary': showBaseline }" :aria-pressed="showBaseline" @click="showBaseline = !showBaseline" > Baselines </button> </div> <RevoGrid ref="gridRef" class="gantt-showcase-grid skip-style cell-border" hide-attribution :readonly="false" :range="true" :resize="true" :row-size="42" :row-headers="false" :auto-size-column="false" :theme="gridTheme" :plugins="plugins" :hide-columns.prop="hiddenColumns" :source="source" :columns="columns" :gantt.prop="ganttConfig" :gantt-dependencies.prop="dependencies" :gantt-calendars.prop="calendars" :gantt-resources.prop="resources" :gantt-assignments.prop="assignments" :gantt-baselines.prop="baselines" /> </div></template>
<script setup lang="ts">import '@revolist/ui/styles.scss';import { vRvControl } from '@revolist/ui/vue-control';import { computed, onMounted, ref } from 'vue';import RevoGrid from '@revolist/vue3-datagrid';import { ExportExcelPlugin, RowStatusPlugin } from '@revolist/revogrid-pro';import { STANDARD_CALENDAR, SHOWCASE_ASSIGNMENTS, SHOWCASE_BASELINES, SHOWCASE_COLUMNS_WITH_COMPLETION, SHOWCASE_DEFAULT_HIDDEN, SHOWCASE_DEPENDENCIES, SHOWCASE_GANTT_CONFIG, SHOWCASE_RESOURCES, SHOWCASE_TASKS, renderShowcaseTaskBarColor, renderShowcaseTaskBarContent,} from '../shared/gantt-project-data';import { currentThemeVue } from '../../composables/useRandomData';
// ── Static grid data ──────────────────────────────────────────────────────────const plugins = ref<unknown[]>([]);const source = ref([...SHOWCASE_TASKS]);const dependencies = ref([...SHOWCASE_DEPENDENCIES]);const calendars = ref([{ ...STANDARD_CALENDAR }]);const resources = ref([...SHOWCASE_RESOURCES]);const assignments = ref([...SHOWCASE_ASSIGNMENTS]);const baselines = ref([...SHOWCASE_BASELINES]);const columns = ref([...SHOWCASE_COLUMNS_WITH_COMPLETION]);const hiddenColumns = [...SHOWCASE_DEFAULT_HIDDEN];const showCriticalPath = ref( Boolean(SHOWCASE_GANTT_CONFIG.visuals.showCriticalPath),);const showBaseline = ref(false);const { isDark } = currentThemeVue();const gridTheme = computed(() => (isDark.value ? 'darkCompact' : 'compact'));const shellClass = computed(() => [ 'gantt-showcase', 'gantt-showcase-shell', 'grow', 'h-full', isDark.value ? 'gantt-showcase-shell--dark' : 'gantt-showcase-shell--light',]);
const ganttConfig = computed(() => ({ ...SHOWCASE_GANTT_CONFIG, visuals: { ...SHOWCASE_GANTT_CONFIG.visuals, showCriticalPath: showCriticalPath.value, showBaseline: showBaseline.value, taskBarColorHook: renderShowcaseTaskBarColor, taskBarContentHook: renderShowcaseTaskBarContent, },}));
// ── Refs ──────────────────────────────────────────────────────────────────────const gridRef = ref<InstanceType<typeof RevoGrid> | HTMLRevoGridElement | null>( null,);
onMounted(async () => { const { GanttPlugin } = await import('@revolist/gantt');
plugins.value = [GanttPlugin, ExportExcelPlugin, RowStatusPlugin];});</script>
<style src="./gantt-showcase.scss" lang="scss"></style>
<style scoped>.gantt-showcase :deep(revo-grid) { flex: 1; min-height: 0;}</style>import '@revolist/ui/styles.css';import { UiControlDirective } from '@revolist/ui/angular-control';import { Component, NO_ERRORS_SCHEMA, ViewEncapsulation } from '@angular/core';import { RevoGrid } from '@revolist/angular-datagrid';import { GanttPlugin } from '@revolist/gantt';import { ExportExcelPlugin, RowStatusPlugin } from '@revolist/revogrid-pro';import type { GanttPluginConfig } from '@revolist/gantt';import { STANDARD_CALENDAR, SHOWCASE_ASSIGNMENTS, SHOWCASE_BASELINES, SHOWCASE_COLUMNS_WITH_COMPLETION, SHOWCASE_DEFAULT_HIDDEN, SHOWCASE_DEPENDENCIES, SHOWCASE_GANTT_CONFIG, SHOWCASE_RESOURCES, SHOWCASE_TASKS, renderShowcaseTaskBarColor, renderShowcaseTaskBarContent,} from '../shared/gantt-project-data';import { currentTheme } from '../../composables/useRandomData';
function createGanttConfig( showCriticalPath: boolean, showBaseline: boolean,): GanttPluginConfig { return { ...SHOWCASE_GANTT_CONFIG, visuals: { ...SHOWCASE_GANTT_CONFIG.visuals, showCriticalPath, showBaseline, taskBarColorHook: renderShowcaseTaskBarColor, taskBarContentHook: renderShowcaseTaskBarContent, }, } as GanttPluginConfig;}
@Component({ selector: 'gantt-showcase-grid', standalone: true, host: { class: 'gantt-showcase-angular-host', }, // Allows Angular demos to bind RevoGrid plugin props that are not wrapper inputs. schemas: [NO_ERRORS_SCHEMA], imports: [UiControlDirective, RevoGrid], encapsulation: ViewEncapsulation.None, styleUrls: ['./gantt-showcase.scss'], template: ` <div [class]="shellClass"> <div class="gantt-showcase-controls"> <button rvControl class="rv-btn rv-btn-sm" [class.rv-btn-primary]="showCriticalPath" [attr.aria-pressed]="showCriticalPath" (click)="setCriticalPath(!showCriticalPath)" > Critical path </button> <button rvControl class="rv-btn rv-btn-sm" [class.rv-btn-primary]="showBaseline" [attr.aria-pressed]="showBaseline" (click)="setBaseline(!showBaseline)" > Baselines </button> </div> <revo-grid class="gantt-showcase-grid skip-style cell-border" [theme]="theme" [hideAttribution]="true" [readonly]="false" [range]="true" [resize]="true" [rowSize]="42" [rowHeaders]="false" [autoSizeColumn]="false" [plugins]="plugins" [hideColumns]="hiddenColumns" [source]="source" [columns]="columns" [gantt]="ganttConfig" [ganttDependencies]="dependencies" [ganttCalendars]="calendars" [ganttResources]="resources" [ganttAssignments]="assignments" [ganttBaselines]="baselines" ></revo-grid> </div> `,})export class GanttShowcaseGridComponent { readonly isDark = currentTheme().isDark(); readonly theme = this.isDark ? 'darkCompact' : 'compact'; readonly shellClass = `gantt-showcase-shell grow h-full ${this.isDark ? 'gantt-showcase-shell--dark' : 'gantt-showcase-shell--light'}`; readonly plugins = [GanttPlugin, ExportExcelPlugin, RowStatusPlugin]; showCriticalPath = Boolean(SHOWCASE_GANTT_CONFIG.visuals.showCriticalPath); showBaseline = false; ganttConfig = createGanttConfig(this.showCriticalPath, this.showBaseline); readonly source = [...SHOWCASE_TASKS]; readonly dependencies = [...SHOWCASE_DEPENDENCIES]; readonly calendars = [{ ...STANDARD_CALENDAR }]; readonly resources = [...SHOWCASE_RESOURCES]; readonly assignments = [...SHOWCASE_ASSIGNMENTS]; readonly baselines = [...SHOWCASE_BASELINES]; readonly columns = [...SHOWCASE_COLUMNS_WITH_COMPLETION]; readonly hiddenColumns = [...SHOWCASE_DEFAULT_HIDDEN];
setCriticalPath(value: boolean): void { this.showCriticalPath = value; this.ganttConfig = createGanttConfig( this.showCriticalPath, this.showBaseline, ); }
setBaseline(value: boolean): void { this.showBaseline = value; this.ganttConfig = createGanttConfig( this.showCriticalPath, this.showBaseline, ); }}GanttPlugin can work with the RevoGrid Pro RowSelectPlugin when you want checkbox-based task selection in the task table.
Add a row-select column, register RowSelectPlugin, and enable the row-order bridge when selected rows should move together during Gantt row reordering.
import { GanttPlugin, isGanttAddTaskRow } from '@revolist/gantt';import { RowSelectPlugin } from '@revolist/revogrid-pro';
const grid = document.querySelector('revo-grid');
grid.plugins = [GanttPlugin, RowSelectPlugin];grid.rowSelect = { rowOrder: true,};grid.columns = [ { prop: 'selected', name: '', rowSelect: ({ model }) => !isGanttAddTaskRow(model), size: 56, readonly: true, filter: false, }, // Task table columns...];The checkbox column uses physical task rows from grid.source. Gantt ignores resource rows and non-task rows when resolving checkbox selection for task operations.
Use isGanttAddTaskRow() when taskCreateRow is enabled so the pinned “Add new task” row does not render a checkbox. See Add Task Row for the draft-row contract.
Bulk Gantt Operations
Section titled “Bulk Gantt Operations”When no explicit task ids are passed, Gantt resolves task ids in this order:
- Checkbox-selected rows from
RowSelectPlugin. - Gantt task range selection.
- The currently focused or selected Gantt task.
This means toolbar buttons, context-menu actions, keyboard handlers, or application code can call the existing Gantt methods without manually collecting checkbox state:
const plugins = await grid.getPlugins();const gantt = plugins.find((plugin) => plugin instanceof GanttPlugin);
gantt?.deleteTasks();gantt?.indentTasks();gantt?.outdentTasks();gantt?.convertTasksToMilestones();After a successful delete, Gantt clears the row-select checkbox state for task rows so removed tasks do not remain selected in RowSelectPlugin.
Row Reordering
Section titled “Row Reordering”Gantt installs RowOrderPlugin internally. RowSelectPlugin does not automatically move all checked rows unless the row-select row-order integration is enabled:
grid.rowSelect = { rowOrder: true,};With rowOrder: true, dragging a checked task row moves the visible checked task rows as one compact block. Dragging an unchecked row keeps the normal Gantt row-order behavior.
Framework Bindings
Section titled “Framework Bindings”<RevoGrid plugins={[GanttPlugin, RowSelectPlugin]} rowSelect={{ rowOrder: true }} columns={[ { prop: 'selected', name: '', rowSelect: ({ model }) => !isGanttAddTaskRow(model), size: 56, readonly: true, filter: false, }, ...taskColumns, ]}/><RevoGrid :plugins="plugins" :row-select.prop="{ rowOrder: true }" :columns="columns"/><revo-grid [plugins]="plugins" [rowSelect]="{ rowOrder: true }" [columns]="columns"></revo-grid>For Vue Gantt examples, use .prop for row-select because it is a direct grid plugin property.