Hello.
I’ve met an issue which I believe you can help me to address.
A some time ago I have created a simple custom attribute to use sortable js https://github.com/RubaXa/Sortable
Here is it. Imports, constructor and some stuff has been omitted.
export class SortableCustomAttribute {
@bindable moveEnd;
@bindable disabled = false;
@bindable handle = null;
...
attached() {
let self = this;
let options = {
onEnd: function(evt) {
if (self.moveEnd) {
self.moveEnd({evt: evt});
}
}
};
if (this.handle) {
options.handle = this.handle;
}
this.inst = Sortable.create(this.element, options);
}
}
As you can see, when attached()
is called it initiates Sortable with a few options.
And as you may guess - moveEnd
property is expected to be a function reference.
Here is the part of the HTML, were this attribute used:
<div class="box-body" sortable="moveEnd.call: sortCb(evt); disabled.bind: dragDisabled; handle: .box-header">
<div class="row" repeat.for="stepInt of viewSteps">
<compose view="./step.html" view-model.bind="stepInt"
class="${dragDisabled ? '': 'draggable-box'}"></compose>
</div>
</div>
And all this stuff worked as expected, but for some reason moveEnd
is no longer populated with a function reference. While sortCb()
method is still exist in the VM,
...
sortCb(evt) {
console.log('move occurred', evt);
arrayMove.mut(this.steps, evt.oldIndex, evt.newIndex);
}
...
a moveEnd
property is always null
.
Here is this method in view-spy
output of bindingContext
:
see next post
Strange thing here is that all methods in __proto__
instead of prototype
.
My platform is windows 10, and I am using webpack with babel.
What I am missing? Is there any way to address this issue?
I will be grateful for any ideas.
Thanks in advance.