Skip to main content

api.getState()

Description

Gets an object with the StateStore properties of Kanban

Usage

api.getState(): object;

Returns

The method returns an object with the following parameters:

{   
areasMeta: object,
before: string | number,
cardShape: object,
cards: array,
cardsMap: object,
cardsMeta: object,
columnKey: string,
columns: array,
dragItemId: string | number,
dragItemsCoords: array,
edit: object,
editorShape: array,
fromAreaMeta: object,
overAreaId: string | number,
readonly: object,
rowKey: string,
rows: array,
scroll: object,
search: object,
selected: array,
sort: object,
dropAreaItemsCoords: array, // deprecated in v1.4
dropAreasCoords: array, // deprecated in v1.4
overAreaMeta: object, // deprecated in v1.4
}

Example

// create Kanban
const board = new kanban.Kanban("#root", {
columns,
cards,
rows
});
// get the State of Kanban
const state = board.api.getState();
console.log(state.cards); // output the cards data
console.log(state.columns); // output the columns data
console.log(state.rows); // output the rows data
console.log(state.cardShape); // output the card configuration
console.log(state.editorShape); // output the editor configuration
//...

Change log: The method was updated in v1.4. The following parameters were deprecated:

  • dropAreaItemsCoords
  • dropAreasCoords
  • overAreaMeta