react-trello
react-trello copied to clipboard
Uncaught TypeError: Cannot read property 'laneId' of undefined for add card
After adding card and add data into table i want to update cards detail with original card id which return from table. For this i have used eventBusHandle like this :
import React, {Component, useEffect, useState} from 'react'; import Board from "react-trello";
const TaskBoard = (props) =>{
const [eventBus, setEventBus] = useState(undefined);
useEffect(() => {
if (card.length !== 0) {
eventBus.publish({type: 'ADD_CARD', laneId:card.column_id, cards: {id: card.id, title: card.title, label: "1 sec", description: card.description}});
}
}, [card.length]);
return(
<Board
id="board1"
components={components}
style={{
background: '#F1F2F4'
}}
data={boardData}
draggable
handleLaneDragStart={handleLaneDragStart}
handleLaneDragEnd={handleLaneDragEnd}
canAddLanes
onLaneAdd={onLaneAdd}
onLaneDelete={onLaneDelete}
handleDragEnd={handleDragEnd}
onCardDelete={onCardDelete}
onCardAdd={onCardAdd}
editable
eventBusHandle={setEventBus}
/>
);
}
I need to update real card id for delete or move other place.

hello, you must add the 'laneId' attribute in your cards.
Example: cards: {id: card.id, **laneId:card.column_id**, title: card.title, label: "1 sec", description: card.description}