I am using Vaadin 14 to develop an application. I use this version as it is the latest LTS version of Vaadin and as such this is a requirement for my current project. I created a grid in which users need to be able to get context menu’s for individual cells in certain columns of the grid. As such, to generate these context menu’s and perform the appropriate actions when their buttons are clicked, I need both information about the item (row) and column.
Up until this point, I have tried the following approaches:
Use addOpenedChangeListener which by default contains this information. Unfortunately, it appears this doesn’t execute before the context menu is opened but rather after it has opened. Changes it makes are only reflected the next time I open a context menu.
Use setDynamicContentHandler which performs the expected behavior, namely executing before the context menu is opened, but has no contextual info about the column.
Use setDynamicContentHandler with an additional addItemClickListener to keep track of the last clicked column. The ItemClickListener would hopefully execute before the DynamicContentHandler and provide it with the necessary column information. Unfortunately, it seems addItemClickListener is not triggered with right clicking. This is weird, as it supports event.getButton(), but anyway.
As such, I am currently rather lost in how I can achieve my goal. Any ideas?
We have a commercial license, so we should have an additional 10 years of support with Vaadin 14. I just read the article stating that major releases have up to 15 years of maintenance with extended warranty. I’ll discuss this within the team, thanks for the heads up.
However, will going to Vaadin 24 resolve my issue from above?
Thanks, this worked with some minor adjustments (e.g. adding ids to columns & making sure getElement() was executed on my Grid element and not something else)