setCurrentPageFirstItemIndex

It seems not to be working. I try to use this method when I want to show the last row of a table after I add a new row that go under the visible rows, but with various values (tried after looking the threads that deals with this) I can’t do it working. Is there a bug? Is there somebody having the same problem?

Hi,

I just happened to use that method the other day, and it seemed to work fine.
Could you post some code that reproduces your problem?

Best Regards,
Marc

Hi,

I have the exact same problem.

private void addNewRow(MyObject obj) {
	myBeanItemContainer.addBean(obj);
	myTable.setValue(obj) // Selects the new item - this works
	myTable.setCurrentPageFirstItemId(obj); // should scroll to the newly added item
}

I’m using a regular BeanItemContainer (which implements Container.Indexed). I understand trying to make the last row the first one in the page isn’t exactly what we should be doing, but it should work because setCurrentPageFirstItemId() and setCurrentPageFirstItemIndex() and safe enough to calculate the maxIndex and adjust properly.

I’ve tried to use both methods but none work as expected.

Just as the OP said, I just want to add a new item to my Table, select it and scroll to make sure sure it is visible - very important from the moment that myBeanItemContainer.size() > myTable.getPageLength().

Any help is greatly appreciated.

Thanks in advance.

Me too.

I’m adding a row to bottom of a a Table’s container. Then these last two lines try to select the added row at the bottom, and scroll it into view:

this.table.setCurrentPageFirstItemIndex( this.table.size() ); // For the user, scroll to display the row of the bean just inserted.
this.table.setValue( bean ); // For the user, pre-select the row of the bean just inserted.

The
Table scrolls, but not quite far enough
. The last row is just out of sight, just below the edge of the Table’s bottom.

In Vaadin 6.7.9.

I wonder if we are experiencing what seems to be a bug in this open
ticket# 8925
? And this open
ticket # 7856
.

–Basil Bourque

This looks like #8925 to me.