Persistence in EJ2 TypeScript Kanban control
18 Apr 20233 minutes to read
State persistence refers to the Kanban state maintained in the browser’s localStorage
even if the browser is refreshed or if you move to the next page within the browser.
State persistence stores Kanban datasource, column and swimlane expand/collapse state in the local storage when the enablePersistence
is defined as true.
import { Kanban } from '@syncfusion/ej2-kanban';
import { kanbanData } from './datasource.ts';
let kanbanObj: Kanban = new Kanban({
dataSource: kanbanData,
keyField: 'Status',
enablePersistence: true,
columns: [
{ headerText: 'Backlog', keyField: 'Open', allowToggle: true },
{ headerText: 'In Progress', keyField: 'InProgress', allowToggle: true },
{ headerText: 'Testing', keyField: 'Testing', allowToggle: true },
{ headerText: 'Done', keyField: 'Close', allowToggle: true }
],
cardSettings: {
contentField: 'Summary',
headerField: 'Id'
},
swimlaneSettings: {
keyField: 'Assignee'
}
});
kanbanObj.appendTo('#Kanban');
<!DOCTYPE html>
<html lang="en">
<head>
<title>Kanban Persistence</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Kanban Persistence" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-base/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-layouts/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/28.1.33/ej2-kanban/styles/material.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js" type="text/javascript"></script>
<script src="systemjs.config.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='loader'>LOADING....</div>
<div id='container'>
<div class="content-wrapper">
<div id="Kanban"></div>
</div>
</div>
</body>
</html>