function addClick() { const cardIds = kanbanObj.kanbanData.map((obj) => parseInt(obj.Id.replace('Task ', ''), 10) ); const cardCount = Math.max.apply(Math, cardIds) + 1; const cardDetails = { Id: 'Task ' + cardCount, Status: 'Open', Priority: 'Normal', Assignee: 'Andrew Fuller', Estimate: 0, Tags: '', Summary: '', }; kanbanObj.openDialog('Add', cardDetails); } function deleteClick() { kanbanObj.deleteCard('Task 1'); } return ( <KanbanComponent id="kanban" ref={(kanban) => { kanbanObj = kanban; }} keyField="Status" dataSource={data} cardSettings={{ contentField: 'Summary', headerField: 'Id' }} dialogSettings={{ template: dialogTemplate.bind(this) }} > <ColumnsDirective> <ColumnDirective headerText="To Do" keyField="Open" showAddButton="true" /> <ColumnDirective headerText="In Progress" keyField="InProgress" showAddButton="true" /> <ColumnDirective headerText="Testing" keyField="Testing" showAddButton="true" /> <ColumnDirective headerText="Done" keyField="Close" showAddButton="true" /> </ColumnsDirective> </KanbanComponent> <ButtonComponent id="addNew" className="e-btn e-dialog-add" onClick={addClick.bind(this)} > Add New Card </ButtonComponent> </td> <td> <ButtonComponent id="delete" className="e-btn e-dialog-add" onClick={deleteClick.bind(this)} > Delete Card </ButtonComponent> |