我通过创建AbstractJavaScriptComponent将一些HTML/JS代码集成到我的Vaadin WebApplication中.组件几乎按预期工作.
如何调用passInfo()"connector.js"中定义的方法,而无需手动单击"chessControll.js"中"chessControll.JsLabel"组件的innerHTML中定义的Button.我的目标是在init()调用函数的onChange事件时传递信息,该事件位于同一文件"chessControll.js"中,但不是Component的一部分.
我已经尝试创建一个自定义事件,然后onChange()在init()调用函数时调度它,只要我没有在我的Component(chessControll.js,chessControll.JsLabel)中监听事件,它就会工作.它似乎只能以静态方式访问.
如何从init()函数中访问"chessControll.js"中的chessControll.JsLabel ,然后调度按钮单击或侦听组件内部的事件以实现相同的效果?
connector.js:
com_*myname*_*applicationName*_JsLabel = function() {
var mycomponent = new chessControll.JsLabel(this.getElement());
connector = this;
this.onStateChange = function() {
mycomponent = this.getState().boolState;
};
mycomponent.click = function() {
connector.passInfo(true);
};
};
Run Code Online (Sandbox Code Playgroud)
chessControll.js:
var chessControll = chessControll || {};
chessControll.JsLabel = function (element) {
element.innerHTML =
"<input type='button' value='Click'/>";
// Getter and setter for the value property
this.getValue = function () {
return element.
getElementsByTagName("input")[0].value;
};
var button …Run Code Online (Sandbox Code Playgroud) 我想在反应表中显示嵌套的 JSON 数据。
我尝试过这样的:
render() {
const columns = [{
//Not Displaying
Header: 'Owner ID',
id: 'ownerid',
accessor: '_links.customer.href.ownerid', // <- i think this is wrong
Cell: this.renderEditable
},
{
//Displaying
Header: 'Price',
accessor: 'price',
Cell: this.renderEditable
}, {
Run Code Online (Sandbox Code Playgroud)
我返回并绑定到表的数据的结构如下:
[
{
"id": 1,
"date": "20.07.2019",
"price": 3.2,
"customer": {
"ownerid": 1,
"firstname": "John",
"lastname": "Johnson"
}
}
]
Run Code Online (Sandbox Code Playgroud)
这里我使用的是列数组:
import ReactTable from "react-table";
<ReactTable data={this.state.offers} columns={columns}
filterable={true} pageSize={10}/>
Run Code Online (Sandbox Code Playgroud)
绑定数据:
fetchOffers = () => {
const token = sessionStorage.getItem("jwt");
fetch(SERVER_URL …Run Code Online (Sandbox Code Playgroud) 我目前正在Vaadin的Java Web应用程序上工作.
我想从另一个类访问位于我的LoginUI中的getter方法.
UI.getCurrent()成功返回当前的Thread(LoginUI).
我需要调用哪些方法才能实现此目的?
先感谢您.