react-trello icon indicating copy to clipboard operation
react-trello copied to clipboard

Uncaught TypeError: Cannot read property 'laneId' of undefined for add card

Open satyendrapg opened this issue 4 years ago • 1 comments

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.

image

satyendrapg avatar Jan 21 '21 12:01 satyendrapg

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}

javalencia18 avatar Mar 11 '22 23:03 javalencia18