Edit particular cell value of a row using vaadin table

Hello vaadin team,
I am new to Vaadin 7. Am facing a problem with vaadin table. Currently my data displaying in vaadin table, in that table each row got one button. When I click that button, I want to change perticular cell value in the same row.

Ex: In a row i have two columns “name” and “button”. when I click button i want change name value in same row.

Suppose in first row column name value is “abc” , when I click button, i want to change te value “abc” to “xyz”.

Thanks in advance


So, what’s the problem you are facing?

Hi Alejandro Duarte,

Thanks for reply.

Here, i have tried sample code for above my issue.

Table table = new Table();

table.addContainerProperty(“Name”, String.class, null);
table.addContainerProperty(“Click”, Button.class, null);

for (int i=0; i<5; i++) {
Button bt_click = new Button(“show”);

bt_click.addClickListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {

table.addItem(new Object {“ABC”+i, bt_click },i);

After that when i click a button in row, I have stuck how do i have to do change the column Name value inside button click event.

Try with something like this:

final int itemId = i; bt_click.addClickListener(event -> { Item item = table.getItem(itemId); item.getItemProperty("Name").setValue("it works!"); }); You might want to try the
component as well. Or even better, start using
Vaadin 8 alpha
, which further simplyfies this among other things.

Hi Alejandro Duarte,

Its worked…Thanks very much

I ll try to use those options also…:slight_smile: