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

How can i block drag/drop any board item? #139

Closed Rampesna closed 3 years ago

Rampesna commented 3 years ago

I want to block some items dragging, how can i do?

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

Rampesna commented 3 years ago
{
  id: id,
  title: title,
  draggable: false // custom data i was add
}

I was add custom data(draggable) for item. And i am controlling this data on dragEl function;

dragEl: function (el, source) {
    if (el.dataset.draggable === 'false') {
        // How can i stop drag transaction at here?
    }
},

I want to stop drag transaction if draggable data is false. I tried return false; but it wasn't work.

This is enought for block any item draggable for me but i cant stop drag transaction.

marcosrocha85 commented 3 years ago

Use this. https://github.com/riktar/jkanban/issues/112#issuecomment-780541170

Rampesna commented 3 years ago

I tried but it gives me an error:

Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null

// ...
var r = function (e) {
    var t = e.getBoundingClientRect();
    return {
        left: t.left + K("scrollLeft", "pageXOffset"),
        top: t.top + K("scrollTop", "pageYOffset")
    }
}(m);
// ...
Rampesna commented 3 years ago

I was fixed problem like that;

var r = function (e) {
    var t = e.getBoundingClientRect();
    if (t) {
        return {
            left: t.left + K("scrollLeft", "pageXOffset"),
            top: t.top + K("scrollTop", "pageYOffset")
        }
    }
}(m);

Thanks!

marcosrocha85 commented 3 years ago

Very good. Please close the issue.