riktar / jkanban

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

undefined board is created when using `$(document).ready` #137

Closed DeveloperMarius closed 2 years ago

DeveloperMarius commented 2 years ago

Hey,

when I'm using the examples of jkanban everything works properly. But after I wrap it in a jQuery $(document).ready(function (){ ... }); block there is always an undefined board and when I define an item array also one undefined item per board generated. I really don't understand why. I hope someone can help me.

<div data-id="undefined" data-order="4" class="kanban-board" style="width: 450px; margin-left: 10px; margin-right: 10px;">
  <header class="kanban-board-header">
    <div class="kanban-title-board">undefined</div>
  </header>
  <main class="kanban-drag"></main>
  <footer>
    <button class="custom-button">+ Add New Card</button>
  </footer>
</div>
<div class="kanban-item" style="cursor: default;">
  <div class="item_handle drag_handler">
    <i class="item_handle drag_handler_icon"></i>
  </div>
  <div>undefined</div>
</div>

Thank you for creating this Projekt. It really helps!

Update: Temporary fixed it using kanban.removeBoard('undefined'); after initializing jkanban.

~ Marius

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

Rampesna commented 2 years ago
<div data-id="undefined" data-order="4" class="kanban-board" style="width: 450px; margin-left: 10px; margin-right: 10px;">

Since you have defined a board whose data-id is undefined, you naturally get it in the board list as well. jKanban works with DOM objects.

Could you explain a little bit, what is the action you want to do?

DeveloperMarius commented 2 years ago

Hello, I think it is not important what I want to do. Just take the example project here and add jQuery to it. After that wrap the code in a $(document).ready and you will get a undefined board created. I really don't know why.

~Marius

riktar commented 2 years ago

@DeveloperMarius can you provide a code example where the bug is replicated?

DeveloperMarius commented 2 years ago

Hey, I could not reproduce this error using the example and jQuery. Maybe something else in my code was the cause of this error. I moved away from the kanban concept for my project and used something else. So the error doesn't appear for me any more. But thank you all!

~ Marius