Lack of interest 'sorter.js' Improvements

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

CMTV

Well-known member
Hi!

Sometimes you need to explicitly set a container for dragula. So, instead of this in sort.js:

JavaScript:
init: function () {
   this.dragula = dragula([this.$target[0]], {
      moves: XF.proxy(this, 'isMoveable'),
      accepts: XF.proxy(this, 'isValidTarget')
   });
},

I propse this:

JavaScript:
init: function () {
   var container = this.$target.data('container') ? this.$target.find(this.$target.data('container'))[0] : this.$target[0];

   this.dragula = dragula([container], {
      moves: XF.proxy(this, 'isMoveable'),
      accepts: XF.proxy(this, 'isValidTarget')
   });
},

Why?

For example, when it is super useful when using XF.ListSorter on <xf:datalist ..> tag. Datalist tag adds a few more containers: table and tbody tags.

So the only way to use it is to extend XF.ListSorter, which resulsts in creating a .js file:

JavaScript:
this.dragula = dragula([this.$target.find('.dataList-table tbody')[0]], {
    moves: XF.proxy(this, 'isMoveable'),
    accepts: XF.proxy(this, 'isValidTarget')
});

Not cool.

With proposed change the only thing we need to do is to add data-container=".dataList-table tbody" attribute.
 
Last edited:
Upvote 2
This suggestion has been closed. Votes are no longer accepted.
Also, we have .js-blockDragafter class for preventing dragging element after the element with this class.

But there is no .js-blockDragbefore class for doing the same when dragging element before the element with this class...
 

Similar threads

Top Bottom