riktar / jkanban

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

removeElement doesn't remove all elements #157

Open richardklingler opened 2 years ago

richardklingler commented 2 years ago

Something weird here happening....

I use ajax to load items on a second board when I click on an item in the first board...all fine....

For the next click in the first board I use getBoardElements(id) and walk through the array to remove all items with removeElement()....like:

var allEle = kanban1.getBoardElements("_working"); console.log("Number of elements: " + allEle.length); allEle.forEach(function(item, index) { kanban1.removeElement(item); console.log('Removed...', item); }); In the console the number of elements is logged correctly in my test as 8....but the iteration is only run 4 times...so leaving back 4 items not being deleted...

From the 8 items before on the second board all even number positions were deleted...so leaving back position 1, 3, 5 and 7....

remove_items

xscode-auto-reply[bot] commented 2 years ago

Thanks for opening a new issue. The team has been notified and will review it as soon as possible. For urgent issues and priority support, visit https://xscode.com/riktar/jkanban

richardklingler commented 2 years ago

Some further testing showed:

When a board contains 8 items....

  1. delete removes half of them, leaving 4 items
  2. delete removes again half of them, leaving 2 items
  3. delete again only deletes half, leaving 1 item
  4. delete removes the last one...
marcosrocha85 commented 2 years ago

Hello @richardklingler, thank you for using jKanban. Can you provide a jsfiddle so we can test it out? I'm seeing everything fine at latest version here in my machine.