request-data
PRO
The functionality is available in PRO Edition only
Dispatched by the widget's render layer when an expanded, visible column has dataStatus: "unknown". The store doesn't load anything itself - it marks the column as "loading" and passes the action through the event bus so external code can fetch the data and respond with provide-data.
Requires dynamicData: true on the component. If dynamicData is false, the action is a no-op.
Usage
type RequestDataPayload = {
id: ColumnID;
};
| Field | Type | Description |
|---|---|---|
id | ColumnID | ID of the column that needs its cards loaded |
Store behavior:
- If
dynamicDataisfalse, or the column ID doesn't exist - no-op. - If the column's status is already
"loading"or"loaded"- no-op. - If the column's status is
"unknown"- sets it to"loading".
When the widget dispatches it:
- Only expanded columns request data. Collapsed columns wait until they're expanded.
- Without
render.virtualizeColumns, every expanded column counts as visible. With it, only rendered columns (including overscan) do. - In the stack layout, visibility is vertical: with
virtualizeColumns, a column requests data when one of its expanded groups is within one viewport height of the visible area. - With swimlanes, requests stay per column: a column with several lanes sends one request, not one per lane.
Trigger
The render layer dispatches this action automatically. Manual dispatch is rare but supported:
api.exec("request-data", { id: "backlog" });
Observe
Listen for the action and fetch cards from a backend:
api.on("request-data", ({ id }) => {
fetch(`/api/columns/${id}/cards`)
.then(res => res.json())
.then(cards => api.exec("provide-data", { id, cards }));
});
Intercept
api.intercept("request-data", ({ id }) => {
// cancel the request for a specific column
return id !== "archived";
});
Component handler
<Kanban
:dynamicData="true"
:cards="[]"
:columns="columns"
:onrequestdata="({ id }) => {
fetch(`/api/columns/${id}/cards`)
.then(res => res.json())
.then(cards => api.exec('provide-data', { id, cards }));
}"
/>
Related
- Working with server - dynamic loading setup
- provide-data - responds with card data for the column
- dynamicData - enables the request-data mechanism