getCards
Returns the raw, unfiltered card array in the order it was provided. This is the persistence snapshot - filters and sorting don't affect it. Use it when you need to serialize the full card set to a backend or local storage.
Usage
getCards(): KanbanCard[]
The method returns the same array that the internal CardsStore holds. It reflects every mutation made through actions (add-card, update-card, move-card, delete-card, duplicate-card) but ignores active filters and sort criteria. The result is not reactive - it's a snapshot at the time of the call.
Example
<script>
import { Kanban } from "@svar-uisvelte-kanban";
let api;
function saveToServer() {
const cards = api.getCards();
fetch("/api/cards", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(cards),
});
}
</script>
<button onclick={saveToServer}>Save</button>
<Kanban bind:this={api} {cards} {columns} />
Related
- cards — the initial card array prop
- getState — full state snapshot including viewData
- export-data — export visible board (filtered view)