riktar / jkanban

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

ADD getALLBoards! #75

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello. I have a suggestion. how about provided getALLBoards? input boardID then return all boards by JSON standard format.

When I add/update board and board's item end then update this result into API input parameter, If getALLBoards function supported, It'll be cool.

Thanks.

marcosrocha85 commented 4 years ago

I guess you can use

var boardsJson = JSON.stringify(jkanban.boards);
youradds commented 4 years ago

Am I missing something? jkanban.boards isn't a valid query? Even trying jKanban.board doesn't work? I found a dirty way to grab them all (and the entries), but I'd prefer if there as a native way to do it!

  var entries = Array.from(document.querySelectorAll(".kanban-container .kanban-board"));

  console.dir(entries);

  entries.forEach(function (entry, index) {

    console.log("FOO: " + entry.getAttribute("data-id")+ " and sort " + entry.getAttribute("data-order"));

    // get each of the elements in this one...
    var allEle = KanbanTest.getBoardElements(entry.getAttribute("data-id"));
    allEle.forEach(function(item, index) {
      console.log(item);

      var theContents = item.innerHTML;
      theContents = theContents.replace("<div class=\"item_handle drag_handler\"><i class=\"item_handle drag_handler_icon\"></i></div><div>","");
      theContents = theContents.replace("</div>","");
      console.log("CONTENTS: " + theContents)
    });

  });
marcosrocha85 commented 4 years ago

Sorry, I missed a property. It's jkanbanInstance.options.boards where jkanbanInstance is the name of the variable you initiated jKanban.

youradds commented 4 years ago

Awesome - thanks , that did it :) Am I missing this in the docs?

marcosrocha85 commented 4 years ago

Awesome - thanks , that did it :) Am I missing this in the docs?

Not at all, the docs are a little bit outdated since we added options attribute to jKanban. By the way, pull requests are welcome. ;)

ColinFay commented 2 years ago

Hey,

I'm trying to get the content of all boards but in the current state, not in the initial state.

If I use the example.html file, after dragging the item, I still have the initial item state.

Screenshot 2022-04-08 at 13 07 59

Is there a way to get the current state of the whole kanban?