groupBy
PRO
The functionality is available in PRO Edition only
Description
Optional. Defines the initial task grouping configuration in GanttUsage
groupBy?: string | {
field: string,
taskHierarchy?: boolean,
resourceHierarchy?: boolean,
multipleResources?: boolean,
ungrouped?: false | "top" | "bottom",
resolver?: (task: ITask) => any,
};
Parameters
field- (required) the field to group tasks by; use"resource"to group by assigned resources, or any task field name (e.g.,"status","priority")taskHierarchy- (optional) if true, preserves the task parent/child structure within each group; Default:falseresourceHierarchy- (optional) if true, shows the resource hierarchy (teams and people) within resource groups; applies only whenfieldis"resource"; Default:truemultipleResources- (optional) if false, tasks assigned to multiple resources appear under each resource separately; if true, such tasks appear once under a combined group label (e.g.,"Alice, Bob"); applies only whenfieldis"resource"; Default:falseungrouped- (optional) controls placement of tasks that have no value for the grouping field:falsehides them,"top"places them above all groups,"bottom"places them below all groups; Default:"bottom"resolver- (optional) a custom function(task: ITask) => valueto extract the group value from a task; overridestask[field]; not applicable whenfieldis"resource"
Example
<script setup>
import { getData } from "./common/data";
import { Gantt } from "@svar-ui/vue-gantt";
const data = getData();
</script>
<template>
<Gantt
:tasks="data.tasks"
:links="data.links"
:scales="data.scales"
:resources="data.resources"
:assignments="data.assignments"
:groupBy="{ field: 'resource' }"
/>
</template>
Related articles: