TableField AddItem Not Refreshing Table

  1. I have a Table Components
  2. The data is adding to it via one button click
  3. The newly added row is visible for fixed number of rows(say if the total visible row count is 10, then upto 10 rows (adding one by one) its visible)
  4. After that a scroll bar will come but, row is not visible
  5. Again row is adding still the refresing of table not happening
  6. If we refresh the whole page using F5 then the rows are visible
  7. I am using vaadin-6.7.1.nightly-20111008-c21651.jar from night build

I encountered the same Problem, I think. At least the description fits. Perhaps I do something terribly wrong, so I wrote a small piece of code, which demonstrates the problem.
Clicking on addrow works just fine, till Nr. 16 is reached. Then the scrollbar is added and the table
doesn’t update anymore.

package com.example.tabletest;


import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;

public class TabletestApplication extends Application {
    Integer index = 0;
	@Override
	public void init() {
		Window mainWindow = new Window("Tabletest Application");
		setMainWindow(mainWindow);
		Panel panel = new Panel();
		panel.setHeight("600px");
		panel.setHeight("600px");
		mainWindow.addComponent(panel);

		final Table table = new Table();
		table.addContainerProperty("rowID", Integer.class, null);
		panel.addComponent(table);
		Button addrowButton = new Button("add row");
		mainWindow.addComponent(addrowButton);
		addrowButton.addListener(new ClickListener() {
            
            public void buttonClick(ClickEvent pEvent) {
                Integer id = getId();
                table.addItem(id);
                table.getItem(id).getItemProperty("rowID").setValue(id);
            }
        });
	}
	private Integer getId() {
	    index++;
	    return index;
	}
}

What do you mean by the table not being updated anymore?
I suspect your problem is simply incorrect size settings for the Table, the Panel and the (implicit) layout of the Panel.

In your case, you also have at least two potentially scrollable areas: the Panel and the Table inside it. With Table, you should usually let it handle its own scrolling - that way, headers stay visible when scrolling and lazy loading of content works.

If you would like the table to expand indefinitely, use zero its page length and make its height undefined. However, this disables lazy loading of table content.

Thank you for the help.

Now I specify the tablesize and I like the scrolling provided by the table.
If I add the (pagelength+1)th row the tablescrollbar appears. Adding another row now does not change the scrollbar.
The scroller of the scrollbar doesn’t change it size and clicking on scroll down does not scroll below the (pagelength+1)th entry.
Which means the newly added row is not accessible at all.

Nevertheless reducing the cacherate to 0 or calling refreshRowCache change this behavior.

This issue has been filed as a bug:
http://dev.vaadin.com/ticket/8077

Hi,

I am facing a similar problem. Is there a work-around for this?
Thank you.

The ticket linked to in my previous post,
http://dev.vaadin.com/ticket/8077
, suggests calling Table.refreshRowCache after adding the row as a workaround.

Hope the workaround works in your case!