This is the problem, I have a vaadin table that represent people information (for example) and when someone clicks on a row I want to extract the cellphone number.
Here is part of the code of the listener:
table_2.addListener(new ItemClickEvent.ItemClickListener() {
@Override
public void itemClick(ItemClickEvent event) { // TODOAuto-generated // method stub
String resultado = (table_2.getItem((Object)event.getItemId()))
+ "";
resultado = resultado.substring(resultado.indexOf("phone"),
resultado.indexOf("|weight"));
label_3.setValue(resultado);
}
});
It worked one time but now it doesn't. The code returns a Null, so when I try to parse the object to string it crash.
Try the following:
table.addListener(new ItemClickListener() {
@Override
public void itemClick(ItemClickEvent event) {
Property itemProperty = event.getItem().getItemProperty("cellphone");
itemProperty.getValue(); // TODO: Do something with this value.
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.