Skip to main content

provide-data

Upserts cards into the store. When id is provided, the cards are assigned to that column via columnAccessor and the column's data status flips to "loaded". Without id, cards are bulk-upserted as-is (used for imports).

If id matches no column, the action is a no-op.

On a board with swimlanes, provide-data sets only the column. Each loaded card goes to the swimlane cell that matches its own lane field (swimlaneAccessor).

Usage​

type ProvideDataPayload = {
id?: ColumnID;
cards: KanbanCard[];
};
FieldTypeDescription
idColumnID (optional)Column to associate the cards with. When set, each card's column field is written via columnAccessor and the column status becomes "loaded".
cardsKanbanCard[]Cards to add or update. Existing cards with matching id values are updated; new cards are inserted.

Trigger​

api.exec("provide-data", {
id: "backlog",
cards: [
{ id: 1, label: "Task one" },
{ id: 2, label: "Task two" },
],
});

Bulk import without a column (cards must already carry their column field):

api.exec("provide-data", {
cards: importedCards,
});

Observe​

api.on("provide-data", ev => {
console.log(`Loaded ${ev.cards.length} cards for column ${ev.id}`);
});

Intercept​

api.intercept("provide-data", ev => {
// strip cards that fail validation
ev.cards = ev.cards.filter(c => c.label);
});

Component handler​

<Kanban
{cards}
{columns}
onprovidedata={ev => {
console.log("Cards provided:", ev.cards.length);
}}
/>