Agent-readable demo data
- Title
- Card Context Menu (JavaScript Kanban) | DayPilot Pro for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Default
- Description
- Read more about Kanban card context menu [doc.daypilot.org].
Inline demo script 1
const kanban = new DayPilot.Kanban("kanban",{
contextMenuCard: new DayPilot.Menu({
items: [
{
text: "Edit...", onClick: async (args) =>{
const card = args.source;
const form = [
{id: "name", name: "Name", type: "text"},
{id: "text", name: "Description", type: "textarea"}
];
const modal = await DayPilot.Modal.form(form, card.data);
if (modal.canceled) {
return;
}
card.data.name = modal.result.name;
card.data.text = modal.result.text;
kanban.cards.update(card);
}
},
{text: "-"},
{
text: "Delete", onClick: (args) => {
kanban.cards.remove(args.source);
}
}
]
})
});
kanban.init();
const app = {
loadData() {
const columns = [
{name: "Analysis", id: "1", barColor: "#f9ba25"},
{name: "Draft", id: "2"},
{name: "Testing", id: "3"}
];
const cards = [
{id: 1, "name": "Task 1", column: "1", text: "This is a description of task #1.", barColor: "#ea3624"},
{id: 2, "name": "Task 2", column: "1", text: "This is a description of task #2.", barColor: "#1155CC"},
{id: 3, "name": "Task 3", column: "1", text: "This is a description of task #3.", barColor: "#999"},
{id: 4, "name": "Task 4", column: "1", text: "This is a description of task #4.", barColor: "#6AA84F"},
{id: 5, "name": "Task 5", column: "2", text: "This is a description of task #5.", barColor: "#F6B26B"},
];
kanban.update({columns, cards});
},
init() {
this.loadData();
}
};
app.init();