How to update a row in Vaadin Table

If I have three rows in Vaadin Table. I wants to update first row. When I update that row, that comes under last. Please give a solution to update in first row.

Updating happens in the ClickListener. Hope this help!


final VerticalLayout layout = new VerticalLayout();
setContent(layout);

final Table table = new Table();
layout.addComponent(table);

// add few columns to the table
final String column1 = "column 1";
table.addContainerProperty(column1, String.class, null);
final String column2 = "column 2";
table.addContainerProperty(column2, String.class, null);

// add few rows to the table
String[] row1 = { "First row, original value", "original value" };
table.addItem(row1, "1");
String[] row2 = { "Second row, original value", "row" };
table.addItem(row2, "2");
String[] row3 = { "Third row, original value", "original value" };
table.addItem(row3, "3");

Button button = new Button("Update row");
button.addClickListener(new Button.ClickListener()
{
	public void buttonClick(ClickEvent event)
	{
		// get the first row's item id
		Object firstRowId = table.getItemIds().iterator().next();
		// get the first row's item
		Item firstRow = table.getItem(firstRowId);
		// update the item
		firstRow.getItemProperty(column1).setValue("Modified value");
	}
});
layout.addComponent(button);