Fix XXX in jKanban

pull/1/head
yflory 5 years ago
parent fbae166702
commit 0074824a0a

@ -568,7 +568,11 @@
(board.item || []).forEach(function (itemkey) { (board.item || []).forEach(function (itemkey) {
//create item //create item
var itemKanban = boards.items[itemkey]; var itemKanban = boards.items[itemkey];
if (!itemKanban) { return; } // XXX clean invalid data if (!itemKanban) {
var idx = board.item.indexOf(itemkey);
if (idx > -1) { board.item.splice(idx, 1); }
return;
}
var nodeItem = getElementNode(itemKanban); var nodeItem = getElementNode(itemKanban);
contentBoard.appendChild(nodeItem); contentBoard.appendChild(nodeItem);
}); });
@ -610,17 +614,24 @@
var boards = self.options.boards; var boards = self.options.boards;
boards.list = boards.list || []; boards.list = boards.list || [];
boards.data = boards.data || {}; boards.data = boards.data || {};
for (var index in boards.list) { var toRemove = [];
boards.list.forEach(function (boardkey) {
// single board // single board
var boardkey = boards.list[index];
var board = boards.data[boardkey]; var board = boards.data[boardkey];
if (!board) { continue; } // XXX clean invalid data if (!board) {
toRemove.push(boardkey);
return;
}
var boardNode = getBoardNode(board); var boardNode = getBoardNode(board);
//board add //board add
self.container.appendChild(boardNode); self.container.appendChild(boardNode);
} });
toRemove.forEach(function (id) {
var idx = boards.list.indexOf(id);
if (idx > -1) { boards.list.splice(idx, 1); }
});
// send event that board has changed // send event that board has changed
self.onChange(); self.onChange();

Loading…
Cancel
Save