I am trying to get scala.js working in conjunction with the w2ui jQuery library. However, when I define my reset action in a form, the behaviour is not as I would have expected.
In order to handle my reset action. I define something like the following in my scalajs code:
...
actions = js.Dynamic.literal(
reset = { form: W2Form =>
form.clear()
}: js.Function1[W2Form, Any],
...
However this causes an error when I click the reset button:
TypeError: this.refresh is not a function
this.refresh();
^
On examining the generated javascript code I can see why this error occurs:
"actions": {
"reset": (function(f) {
return (function() {
return f.apply__O__O(this)
})
})(new $c_sjsr_AnonFunction1().init___sjs_js_Function1((function(form$2) {
return (0, form$2["clear"])()
}))),
This can be rectified changing the last line by hand to:
return (form$2["clear"])()
Can someone tell me what I am doing wrong?