riktar / jkanban

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

Load Items with fetch or ajax #101

Closed vatc0 closed 3 years ago

vatc0 commented 3 years ago

Hi,

I am trying to load the items from db with ajax or fetch but I can't find any example on how to do this.

The call is made and i get valid json but i don't know how to make it available in the item section.

In the middle board i try to use a var defined in the done function. if i log that var i can see the that the json is valid.

Could someone help me with an example on how to achive this? Many thanks! Bellow is a part of the code

` $.ajax( { url: 'data.php', type: 'POST', async:'false', data: {origin:origin,dest:dest}, dataType: 'json' })

.done(function(data)
{ var showdata = data;})

},

      boards: [

        {
          id: "_sales",
          title: "Sales Office",
          class: "info",
          dragTo: ["_middle"],
          item: [
            {
              id: "2000",
              title: "Try drag this (Look the console)",
              drag: function(el, source) {

              },
              dragend: function(el) {

              },
              drop: function(el) {

              }
            },
            {
              title: "Try Click This!",

              class: ["peppe", "bello"]
            }
          ]
        },

        {
          id: "_middle",
          title: "Middle Office",
          class: "danger",
          item:  [showdata]

        },
        {
          id: "_done",
          title: "Current Office",
          class: "success",
          dragTo: ["_working"],
          item: [
            {
              title: "All right"
            },
            {
              title: "Ok!"
            }
          ]
        }
      ]
    });`
xscode-auto-reply[bot] commented 3 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