CMTV
Well-known member
Hi!
Sometimes you need to explicitly set a container for dragula. So, instead of this in
I propse this:
Why?
For example, when it is super useful when using
So the only way to use it is to extend
Not cool.
With proposed change the only thing we need to do is to add
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