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 the target column doesn't exist, the action is a no-op.
Usage
type ProvideDataPayload = {
id?: ColumnID;
cards: KanbanCard[];
};
| Field | Type | Description |
|---|---|---|
id | ColumnID (optional) | Column to associate the cards with. When set, each card's column field is written via columnAccessor and the column status becomes "loaded". |
cards | KanbanCard[] | 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={cards}
columns={columns}
onProvideData={(ev) => {
console.log("Cards provided:", ev.cards.length);
}}
/>
Related
- Working with server - dynamic loading and import workflows
- request-data - triggers the data request for a column
- dynamicData - enables on-demand column loading
- ExcelImport - import wizard that feeds provide-data