getEditorItems
Description
Returns the full default configuration of editor fieldsUsage
getEditorItems(config?: {
unscheduledTasks?: boolean,
}): IEditorItem[];
Parameters
config(optional) — an object with the next parameter:unscheduledTasks—PRO featureadds the "Unscheduled" toggle field
Returns
Returns an array of editor-form field configuration objects. Conditional fields are included only when their config property is provided. If no parameter is defined, only default config is returned.
[
{
key: "text",
comp: "text",
label: "Name",
config: { placeholder: "Add task name" }
},
{
key: "details",
comp: "textarea",
label: "Description",
config: { placeholder: "Add description" }
},
{ key: "type", comp: "select", label: "Type" },
{ key: "start", comp: "date", label: "Start date" },
{ key: "end", comp: "date", label: "End date" },
{
key: "duration",
comp: "counter",
label: "Duration",
config: { min: 1 }
},
// appears only if config.unscheduledTasks is true
{
key: "unscheduled",
comp: "twostate",
label: "",
config: {
value: true,
text: "Unschedule",
textActive: "Schedule"
}
},
// end
{
key: "progress",
comp: "slider",
label: "Progress",
config: { min: 1, max: 100 }
},
{ key: "links", comp: "links", label: "" }
]
Example
<script>
import { Gantt, getEditorItems } from "@svar/svelte-gantt";
import { getData } from "../data";
const data = getData();
function init(api) {
const items = getEditorItems({
unscheduledTasks: true
});
console.log("Editor items:", items);
}
</script>
<Gantt
tasks={data.tasks}
links={data.links}
scales={data.scales}
{init}
/>
Related article: defaultEditorItems