riktar / jkanban

Vanilla Javascript plugin for manage kanban boards
https://www.riccardotartaglia.it/jkanban/
Apache License 2.0
1.07k stars 299 forks source link

Copy item between boards #36

Closed rhuodox closed 5 years ago

rhuodox commented 5 years ago

Hey there,

How make a copy of item between boards? I need use some extension or adaptation from Dragula or exists some function or option for the item?

Regards.

marcosrocha85 commented 5 years ago

Hello @rhuodox. Do you want copy or move an item? Technically you can copy an item content to another board by using API like:

// Copies an item to another board
var myItemId = "item1";
var newBoard = "_working";
var currentItem = jkanban.findElement(myItemId);
jkanban.addElement(newBoard, {
    'id': currentItem.dataset.id,
    'title': currentItem.innerHTML
});

// To move, you can do the same and remove it's original item
var myItemId = "item1";
var newBoard = "_working";
var movingItem = jkanban.findElement(myItemId);

jkanban.removeElement(myItemId);

jkanban.addElement(newBoard, {
    'id': movingItem.dataset.id,
    'title': movingItem.innerHTML
});