Grid: addItem to Container and grid.editItem() immediately after messes up

…the item Editor (topic wasn’t long enough :D)

Hi together,

I have a quite serious problem with the new Grid-Component. I want to do a simple Key-Value Editor with possibility to add new Items. If I do

private void addRow()
    {
        Object itemId = container.addItem();

        grid.editItem(itemId);
    }

the editor doesn’t always show up and I get the following
JavaScript
Error:

com.vaadin.client.ApplicationConnection
SEVERE: Error performing server to client RPC callsjava.lang.IllegalStateException: Row with logical index 35 is currently not available in the DOM

This only seems to occur when the grid has to scroll before opening the item editor.
Strange thing is that it sometimes works the first time I call addRow().

Any hints what I could do differently are welcome.

You are using the method differently what I have been used to. Check if it works this way

Object itemId = new YourObjectType(...) grid.GetContainerDataSource().addItem(itemId); grid.editItem(itemId); Atleast this way it workds for me.

I don’t use a Bean- or BeanItem-Container, just simple Indexed Container where I add the the items and properties by the given methods (container.getItem(itemId).getProperty(“name”).setValue(“value”)…)

But I gave it a quick try - nothing changes.
The really strange thing is that it sometimes works, sometimes not. There is also no error on the Java-Side, only JavaScript.

I use vaadin-spring Addon and vaadin-spring-security extension (currently 0.0.6.RELEASE) and wonder if something in there could cause the problem.

If anyone has an idea, please share.

Hi, this may be an issue with the order of RPC calls in the server-client communication - if the client gets the editItem call before it receives information of the added row, this will probably happen. I’ll see if I can reproduce the problem.

If it helps you: This only happens if the Grid content is so big that it has to be scrolled. It never happens when I for example set the height (rows) of the grid to a number higher than the actually present items.
Unfortunately it’s not easy to extract that part of my application to give you an example, but if you can’t reproduce I’ll try to set up something.

Should I open a ticket?

Hi @Samuel Nitsche, i have the same issue.
It would be nice to not have to resize the table everytime.

Did you managed to solve this?

Thanks!