ContextMenu
Description
ContextMenu helperUsage
<ContextMenu {at} {resolver} {handler} {options} {filter} />
You can import the component from @svar-ui/svelte-velte-gantt .
Parameters
All parameters description you can find here: ContextMenu
Example
In the example below we hide the "Delete" menu option for the project type. You should also pass the api
object to ContextMenu (for more details, refer to How to access Gantt API). Other usage examples see here: Configuring Context Menu.
<script>
import { getData } from "../data";
import { Gantt, ContextMenu } from "@svar-ui/svelte-velte-gantt";
let api = $state();
const data = getData();
const filterMenu = (option, task) => {
// hide the "delete" item for projects
const type = task.type;
if (option.id === "delete-task" && type === "project") return false;
return true;
}
</script>
<ContextMenu {api} filter={filterMenu} >
<Gantt
bind:this={api}
tasks={data.tasks}
links={data.links}
scales={data.scales}
/>
</ContextMenu>
Related articles: