How do I fill a handsontable from a javafx WebView using a JSObject?

258 Views Asked by At

I try to use the api method loadData (data: Array). The handsontable has two text columns.

I get the JSObject calling:

JSObject jsTable = (JSObject) webView.getEngine().
executeScript("$('#example').handsontable('getInstance')");

I construct the data array like this:

Object[] data = new Object[]{
    new Object[]{"s1", "s2"},
    new Object[]{"s3", "s4"}};

And call:

 jsTable.call("loadData", data);

But get a *netscape.javascript.JSException: RangeError: Range error* exception.

What am I missing?

Later edit: The following, which sets the content of a single cell, works.

Object[] params = {0, 0, "s1"};
jsTable.call("setDataAtCell", params)
1

There are 1 best solutions below

1
PostureOfLearning On

Try setting data to followig instead:

var data = [
    ["s1", "s2"],
    ["s3", "s4"]
];

For more details on datasources see here:

http://handsontable.com/demo/datasources.html