Grid: Edititem doesn't work on Chrome when item out of view

Hi

I am using the grid and I got a problem when I add items to it. What I want to do is to give the user to edit the item directly when it is added. So what I do is:

// myContainer is a BeanItemContainer and grid is a Grid :)
public void addItem( Item newItem ){
    myContainer.addBean( newItem );
    grid.scrollTo( newItem );
    grid.editItem( newItem );
}

And this seems to work correctly, I keep on adding items and I get to the inline editor directly when the add item button is pushed. Until I get too many items and they are added outside the view. Firstly, the “grid.scrollTo()” doesn’t seem to work since I go outside the view whenI keep adding more items and then when I am completely outside the view (2-3 items too much) the really weird thing happens.
It seems that I am in the inline editor but it is not shown. Since I can not do anything with the grid or even push the buttons, only thing I can do is to refresh the page.

And the funny thing is that this works perfectly in Internet Explorer 11, the problems occur only in Chrome browser.

So, please help me…what am I doing wrong?

Best Regards
Jani

That sounds peculiar. Moreover according to our specs you do not need grid.scrollTo(newItem) in this case, since grid.editItem(newItem) should scroll to edited row automatically.

You are completely right, I didn’t notice that. But the behaviour on Chrome is still the same…If I keep adding items I go outside the view and then I get stuck… :frowning:

Tatu, what we did to get around this was to manage our data items outside the Grid, then call something like this:

myGrid.setContainerDataSource(new BeanItemContainer<>(DataClass.class, data)); While it isn’t the most elegant solution, it works well for us. Fortunately, we don’t add items individually much in out Grids.

… so sorry, forgot something very very important. Before setting your Datasource, make sure to remove all items from the grid:

myGrid.getContainerDataSource().removeAllItems();

Hmm… Well, Dan, for me this doesn’t help so much since we need to be able to add items individually by an add button… and it would be nice to be able to use the inline editor to add an item to the grid and let to user edit it before it is saved into the database.

And…as we have a lot of data, it would very ineffective to remove all items everytime we add something to the grid :smiley:

Which framework version you have used? I recommend to check 7.6-SNAPSHOT and verify if the issue still persists. There is number of Grid fixes coming up.

We have used the 7.5.4 version but I just saw that 7.5.6 is out. I’ll try with that one and then if it doesn’t work, with the 7.6-SNAPSHOT as you tell me :slight_smile:

I have just tried the 7.6.0.aplha2 version I found in maven central and the bug does not exist in it :slight_smile: YEEEY

But we are not confident to mvoe to this version before it is released…I my question is, when is the release of it planned? :slight_smile:

Hi,

Vaadin 7.6.0 is planned to be released during October. Since it’s still in alpha, I’d guess it will be released on the latter half of October.

-tepi

Thanks :slight_smile: