Closed alexandru78 closed 4 years ago
I'm afraid Grid doesn't actually support reusable details row contents, you are supposed to generate them from scratch for every row, just like with ComponentRenderer. I poked around a bit to see if the support could be added easily, but it's a timing issue (sometimes the detach is processed before the new details row handling, sometimes after, which causes a client-side exception and interrupts both processes) and I couldn't find any trivial way to enforce the order of operations or to explicitly trigger the detach before the default handling gets there without breaking other things. The client-side assumes that you can have multiple details rows open at the same time and it has no way to know that your server-side is enforcing things otherwise. That reusing contents worked even in 8.8.6 was accidental and presumably caused by a lot of Grid handling happening with a delay, which in turn caused many other layouting and performance issues, so unfortunately reintroducing those delays isn't really an option.
I'm afraid Grid doesn't actually support reusable details row contents, you are supposed to generate them from scratch for every row, just like with ComponentRenderer. I poked around a bit to see if the support could be added easily, but it's a timing issue (sometimes the detach is processed before the new details row handling, sometimes after, which causes a client-side exception and interrupts both processes) and I couldn't find any trivial way to enforce the order of operations or to explicitly trigger the detach before the default handling gets there without breaking other things. The client-side assumes that you can have multiple details rows open at the same time and it has no way to know that your server-side is enforcing things otherwise. That reusing contents worked even in 8.8.6 was accidental and presumably caused by a lot of Grid handling happening with a delay, which in turn caused many other layouting and performance issues, so unfortunately reintroducing those delays isn't really an option.
thank you for looking into this. Last interesting bit is the "ordering fact": in my real grid this behaviour does not happen if the user selects item going down - selecting row1, row3, row5 or some other row with an increasing index from the start to the bottom. yet it always happens if the user selects item backwards, starting from bottom to top.
do you think this might be random also? if that's the case I believe you can close this right away.
Yes, the DetailsChangeHandler.dataUpdated
within DetailsManagerConnector
is generally called in the index order of all the rows that have been updated within the same server-client roundtrip, so when you move down, the initial spacer is removed before the new spacer is added. Going up it tries to add the new spacer before removing the old one, which causes issues.
Strange enough, the reported behaviour does not happen when user selects row2 after row1 : everything is as expected - row1 has no detail, the detail of row2 has a good height and shows heavy label.
I noticed this behaviour with Vaadin version 8.9.3. With Vaadin version 8.8.6 it is not possible to reproduce this behaviour.
Minimal reproducible example `
`
`