在Vaadin有可能注册一个JavaScript函数,例如像这样:如何使用返回值在Vaadin中添加JavaScript函数?
JavaScript.getCurrent().addFunction("openObj", new JavaScriptFunction() {
private static final long serialVersionUID = 9167665131183664686L;
@Override
public void call(JsonArray arguments) {
if (arguments.length() != 1) {
Notification.show("Wrong arguments for openObj: " + arguments.asString());
return;
}
openObject(arguments.get(0).asString());
}
});
是它在某种程度上可以注册具有返回值的函数?
我使用您的解决方法将内容存储在JavaScript变量中,然后从HTML中访问该变量。有点棘手,因为当我访问变量时,vaadin没有注册它。所以我需要一个超时功能。不是最干净的解决方案,但它的作品感谢提示。 –