registerEditorItem
Description
Registers a custom UI component for use as a field in the EditorIt registers a custom Vue component to be used as an editor field (comp). The registered component must support the value property and onchange callback as in Editor.
Usage
registerEditorItem?: (
type: string,
handler: Component<any>
) => void;
Parameters
type- (required) a unique identifier for the editor controlcontrol- a Vue component that implementsvalueproperty andonchangecallback as in Editor.
Example
The example shows how to add a custom editor field using the radio button component:
<script setup>
import { Gantt, Editor, getEditorItems, registerEditorItem } from "@svar-ui/vue-gantt";
import { RadioButtonGroup } from "@svar-ui/vue-core";
registerEditorItem("radio", RadioButtonGroup);
const items = [
...getEditorItems,
{
key: "type",
comp: "radio",
label: "Type",
options, // options for radio
type: "inline",
}
];
const api = ref();
</script>
<template>
<Gantt ref="api" />
<Editor :api="api" :items="items" />
</template>
Related articles: