Hi Folks,
I’m trying to pass a numeric array to my javascript component using the callFunction(…) API.
I’ve tried passing double
, Double
and List but none of these appear to work for me. At best, I just get an empty Object { } in my javascript method.
e.g. JSSlider.java
[code]
public class JSSlider extends AbstractJavaScriptComponent {
…
public void changeLabels(double labelsAdd) {
callFunction(“changeLabels”, labelsAdd);
}
…
}
[/code]JSSLider-connector.js
window.uk_co_comsci_vaadintest_JSSlider = function() {
// Create the component
var element = this.getElement();
var mySlider = new mylibrary.JSSlider(element);
var self = this;
...
this.changeLabels = function(labelsAdd) {
mySlider.changeLabels(labelsAdd);
};
};
JSSlider.js
var mylibrary = mylibrary || {};
mylibrary.JSSlider = function (element) {
element.innerHTML = "<div class='slider'></div>";
...
this.changeLabels = function (labsAdd) {
for (var i = 0; i < labsAdd.length; i++) {
...
}
}
I’ve snipped lots of the code to avoid clutter. Hopefully what’s left is enough to detail the problem. The javascript component appears to work fine in other respects and I can pass arrays across in the shared state and I can pass simple java primitives across via callFunction
Should I also be able able to pass arrays or Lists as callFunction arguments?
Many thanks,
Dave.