Gwt 我想将复选框字符串转换为复选框对象,并检查它是否被选中
下面的函数设置flextable中的复选框。使用sethtmlGwt 我想将复选框字符串转换为复选框对象,并检查它是否被选中,gwt,checkbox,Gwt,Checkbox,下面的函数设置flextable中的复选框。使用sethtml public void populateData(int index, CartItem newLine) { int i = 0; for (WebMenuAttribute attribute : columns) { String result = getPropertyValue(newLine, attribute.getName()); if(!isWidget)
public void populateData(int index, CartItem newLine) {
int i = 0;
for (WebMenuAttribute attribute : columns) {
String result = getPropertyValue(newLine, attribute.getName());
if(!isWidget)
this.setText(index, i++, result);
else
this.setHTML(index, i++, result);**
}
}
我使用下面的语句检索复选框
String test = shoppingCartTable.getHTML(i, vendorIndex);
在这两种情况下都选中或取消选中时,它将返回此字符串。。
我想把它转换回复选框,并检查它是否被选中。
如果有任何帮助,我们将不胜感激。您可以使用document.getElementById获取元素,并可以获取对象的值。 如果你想完成这项任务将变得非常容易,你可以很容易地得到对象。
您仍然可以尝试按id获取elment,而get the value返回此字符串****您不使用setWidget和getWidget的任何原因?因为我正在将这些复选框动态创建到flextable中。setwidget正在给出对齐问题..我不知道元素id是什么。由于复选框是动态生成的,所以可以没有任何复选框。您可以使用一些计数器或代码动态生成id。然后根据ID进行识别,只有您才能识别唯一性