viritin / viritin

The "commons" library for Vaadin developers
https://vaadin.com/addon/viritin
Apache License 2.0
153 stars 77 forks source link

MGrid add issue #254

Closed viydaag closed 7 years ago

viydaag commented 7 years ago

I have a strange behavior with MGrid when I had a item. The grid's first line is always blank.

I have a view with a mgrid and an abstract form. When I click "save", the SavedHandler calls my method to reload the data.

service.save(entity); //add to backend
closeForm(); //calls form.setEntity(null)
listEntries(); //calls grid.lazyLoadFrom(...)

I tries also "grid.refreshRows()" as an alternative to "listEntries()" but I have the same result.

Whe I inspect the html, I see there is an extra generated at the end overlapping the first row.

I don't know if there is a problem with the container or the grid.

mstahv commented 7 years ago

I haven't seen anything like that. Is there a test case I or somebody else could use to debug the issue?

viydaag commented 7 years ago

Maybe its not related to viritin addon but I got this error in the vaadin debug window when I add an object to the backend and I refresh my rows in mgrid. Am I missing something or it's a client issue?

2450341ms   Server to client RPC call: 136:com.vaadin.shared.data.DataProviderRpc.resetDataAndSize([19])
2450348ms   Error performing server to client RPC callsjava.lang.IndexOutOfBoundsException: Index: 18, Size: 0
...
2450405ms   Can't get element 12java.lang.IndexOutOfBoundsException: Can't get element 12
mstahv commented 7 years ago

Hmm, do you think it would be hard to create an example project that I could test? If it you can't share it publicly, feel free to throw it to me with email.

viydaag commented 7 years ago

I have created a test project from latest vaadin app maven archetype, so it should not be hard to install and test. Simply compile and run the app on any web server and click on the "+" button to add an entity. Then write a name and click "Enregistrer". The grid should contain a blank line as first line.

testmgrid.zip

mstahv commented 7 years ago

It turns out that you faced a quite odd Grid bug. I reduced your test case quite a bit and it can apparently be reproduced with just following (without MGrid or anything Viritin related):

    final VerticalLayout layout = new VerticalLayout();

    Grid g = new Grid();
    g.addColumn("A");
    g.addRow("1");

    Button b = new Button("Add");
    b.addClickListener( e-> {
        g.addRow("2");
        b.setVisible(false);
    });

    layout.addComponents(b,g);
    setContent(layout);

I'll file a core Vaadin bug report about this, as a critical issue. Thanks for pointing this out!

mstahv commented 7 years ago

Track this issue: https://dev.vaadin.com/ticket/20477#ticket

@viydaag do you have a pro subscription? To me this seems so critical that I'd use BFB for this.

viydaag commented 7 years ago

No I do not have pro subscription. Thanks for checking this out. It seemed weird to me because I did not find the bug in your viritin tests with MGrid.

You remind me that I have already posted something about this problem on the Vaadin forum Still unanswered.

What is BFB by the way?

mstahv commented 7 years ago

BFP: bug fix priority, a service which allows you to get your bug reports to the top of our teams TODO list

Can you find me the forum thread? I haven't had time for forum lately.

viydaag commented 7 years ago

The forum link is on my previous post on the word "forum".

mstahv commented 7 years ago

Oh yeah, thanks, sorry. I didn't see that from email client.

mstahv commented 7 years ago

Vaadin 7.7.6 is now out with a fix to this!