hejianxian / vddl

🦄 Vue components for modifying lists with the HTML5 drag & drop API.
http://hejx.space/vddl
MIT License
395 stars 75 forks source link

Canceling drop not working #60

Open jetsmartone opened 5 years ago

jetsmartone commented 5 years ago

I need cancel dropping in 'drop' callback. 'return false' dont work because, List.invokeCallback('drop',...) always return 'true'.

invokeCallback: function invokeCallback(expression, event, index, item) {
      var fn = this[expression];
      if (fn) {
        fn({
          event: event,
          index: index,
          item: item || undefined,
          list: this.list,
          external: !this.vddlDragTypeWorkaround.isDragging,
          type: this.vddlDragTypeWorkaround.isDragging ? this.vddlDragTypeWorkaround.dragType : undefined
        });
      }
      --Attention--> return fn ? true : false;
    },

While must be

return fn({...