Skip to main content

dynamicData

The functionality is available in PRO Edition only

PRO

Enables on-demand column loading. When enabled, the board starts without card data and requests cards for each column as it becomes visible. For an expanded, visible column with dataStatus: "unknown", the widget dispatches request-data and the store marks the column "loading". The host responds with provide-data.

Usage​

dynamicData?: boolean;
  • false (default) - static mode. All columns count as loaded, and the cards array must contain all cards up front.
  • true - dynamic mode. Columns start with a dataStatus of "unknown". When such a column is expanded and visible, the widget dispatches request-data and the store marks the column "loading". The host fetches data and responds with provide-data to mark the column "loaded".

Example​

import { useState } from "react";
import { Kanban } from "@svar-ui/react-kanban";

const columns = [
{ id: "backlog", label: "Backlog" },
{ id: "doing", label: "In Progress" },
{ id: "done", label: "Done" },
];

function App() {
const [api, setApi] = useState(null);

return (
<Kanban
columns={columns}
dynamicData
cards={[]}
init={obj => setApi(obj)}
onRequestData={async ({ id }) => {
const cards = await fetch(`/api/columns/${id}/cards`).then(r => r.json());
api.exec("provide-data", { id, cards });
}}
/>
);
}