Skip to main content

getCards

Returns the raw, unfiltered card array in the order it was provided. Filters and sorting don't affect it, so it works as the persistence snapshot. Use it to save the full card set to a backend or local storage.

Usage​

getCards(): KanbanCard[]

The method returns the same array that the internal CardsStore holds. The array reflects every change made through actions (add-card, update-card, move-card, delete-card, duplicate-card). Active filters and sort criteria don't apply. The result isn't reactive - it's a snapshot taken at call time.

Example​

<script setup>
import { ref } from "vue";
import { Kanban } from "@svar-ui/vue-kanban";

const api = ref(null);

function saveToServer() {
const cards = api.value.getCards();
fetch("/api/cards", {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(cards),
});
}
</script>

<template>
<button :onclick="saveToServer">Save</button>
<Kanban ref="api" :cards="cards" :columns="columns" />
</template>
  • cards - the initial card array prop
  • getState - full state snapshot including viewData
  • export-data - export visible board (filtered view)