How to show the latest rows of the dynamic table?

I have a table, the data in table are added dynamic. I use the ICEPush to notice the browser that the data changed. The code below:


                Container c = table.getContainerDataSource();
		Object itemId = c.addItem();
		Item item = c.getItem(itemId);

		String appname = map.get("appname");
		String title = map.get("title");
		String type = map.get("type");

		item.getItemProperty(MSGINFO_PROPERTY_APPNAME).setValue(appname);
		item.getItemProperty(MSGINFO_PROPERTY_TITLE).setValue(title);
		item.getItemProperty(MSGINFO_PROPERTY_TYPE).setValue(type);

		table.select(itemId);

When the data in the table beyond the cureent screen, the scroll bar(vertical) will show. But how can I show the latest rows in the current screen? I use the table.select, but it doesn’t work. I’m a newer to Vaadin, Thank you for your help.

You can use
Table#setCurrentPageFirstItemId()
. It causes the table to scroll to the row having the given id. There’s also Table#setCurrentPageFirstItemIndex().

Please note, however, that there is a known issue with these methods:
ticket 8925

I used the setCurrentPageFirstItemId,but it doesn’t work. The code I used is below:


Container c = table.getContainerDataSource();
		Object itemId = c.addItem();
		Item item = c.getItem(itemId);
		
		itemId2Log.put(itemId, l);
		
		CheckBox cb = new CheckBox();
		String id = l.getId();
		String time = l.getTime();
		String degree = l.getDegree();
		String position = l.getPosition();
		String message = l.getMessage();
		
		item.getItemProperty(LOGINFO_PROPERTY_CHECKBOX).setValue(cb);
		item.getItemProperty(LOGINFO_PROPERTY_ID).setValue(id);
		item.getItemProperty(LOGINFO_PROPERTY_TIME).setValue(time);
		item.getItemProperty(LOGINFO_PROPERTY_DEGREE).setValue(degree);
		item.getItemProperty(LOGINFO_PROPERTY_POSITION).setValue(position);
		item.getItemProperty(LOGINFO_PROPERTY_MESSAGE).setValue(message);
		
		table.select(itemId);
		table.setCurrentPageFirstItemId(itemId);

I have find another way to solve the question. To insert the item in the front of the table. Use IndexedContainer.addItemAt(0). But I perfer the first way.