parse()
Description
Parses data into Kanban
The parse() method is an alias for setConfig() restricted to data-related properties (cards, columns, rows, links). Both methods perform the same operation under the hood for these properties.
Prefer setConfig()
Use the setConfig() method that accepts the same data properties plus other Kanban configuration option. Call setConfig() once for all props instead of calling parse() for data and setConfig() for the other props (such as columnKey, rowKey, cardShape):
// instead of two calls
kanban.setConfig({ columnKey: "type" });
kanban.parse({ columns });
// use one
kanban.setConfig({
columnKey: "type",
columns
});
Usage
parse({
columns?: array,
rows?: array,
cards?: array,
links?: array
}): void;
Parameters
columns- (optional) the array of objects of the columns datarows- (optional) the array of objects of the rows datacards- (optional) the array of objects of the cards datalinks- (optional) the array of objects of the links data
Example
// create Kanban
const board = new kanban.Kanban("#root", {});
// parse data into Kanban
board.parse({
columns,
cards,
rows,
links
});
// equivalent call via setConfig()
// board.setConfig({ columns, cards, rows, links });
Change log: Starting from v1.1 you don't need to reset initial data in constructor before parsing new data
Related articles: Working with Data