Bug ?? : V14+ Grid : state of setDetailsVisibleOnClick(boolean) lost after

Hi,

I have a grid (tested with v14.1.5, v14.1.16, v14.1.23) which is initializing with ‘secUserGrid.setDetailsVisibleOnClick(false)’.
The bean is loaded via the autowired annotation in the view.

After the onDetach and onAttach event of the view, the setDetailsVisibleOnClick is suddenly set to true and the items are clickable opening the detailspanel.
This messes up the part where I decide myself with another addItemClickListener whether or not to open the detailspanel on a click.

I have tested this with disabling my own listeners and have a fairly naked grid.
Only the setDetailsVisibleOnClick set to false and then invoking a onDetach/onAttach event changed state for me.

Can someone investigate whether or not this classifies as a bug ?
It is to me.

More context of my use case can be found here :
https://vaadin.com/forum/thread/18234899/vaadin-grid-detailspanel-open-and-close-but-not-for-icon-clicks

Regards,
Jorn

Update :

I found that if i set setDetailsVisibleOnClick(true) in the onDetach event, and afterwards setDetailsVisibleOnClick(false) on the onAttach event solves my initial problem.
But the grid.setDetailsVisibleOnClick(true) generates a JS error (Typescript erro) so it does not count as a workaround.

See the screenshot for running this code :

	@Override
    protected void onDetach(DetachEvent detachEvent){
        secUserGrid.setDetailsVisibleOnClick(true);
    }

18239620.png

The only valid workaround i can come up with is entirely in the onAttach event.
By adding the following in the onAttach event, my use case is solved but I would still ask to some engineer to look into it because it smells like a bug (see 2 posts above).

The reason why i specifically need to set it to true and to false is this.

  • If I only set it to false → the my ItemClickListener can only open the panel but not close it anymore.
  • If I specifically set it to true and then back to false, my ItemClickListener is again behaving as expected and as desired.
@Override
protected void onAttach(AttachEvent attachEvent) {
	// Bug because after ondetach/onattach it is again set to true
	secUserGrid.setDetailsVisibleOnClick(true);
	secUserGrid.setDetailsVisibleOnClick(false); 
}

Thanks for reporting. I created an issue https://github.com/vaadin/vaadin-grid-flow/issues/959. If you have any comments, please add there.

Thx Tulio for your swift reply and followup !