How to consume Ctrl + click OR Shift + Click event on vaadin table

I am using a vaadin table and that gets some dynamic data filled. Is there a way to control the action on a table column cell with ctrl+click or shift + click differently for each cell?

Ex: Say I have a table with col1 & col2. I need a different behavior as below:

When I click on col1 cell, I need to change the cell content and avoid row selection.
But when I click on col2 cell, I just need to select the row no changes to cell data.
Is there a way to achive this?


Haven’t tried this specific scenario and I don’t have time for it right now either, but ItemClickListener might help you. With that you can limit actions to a specific column and modifier key like this:

table.addItemClickListener(new ItemClickListener() {

        public void itemClick(ItemClickEvent event) {
            if ("col1".equals(event.getPropertyId()) && event.isCtrlKey()) {
                System.out.println("do stuff for col1!");
            } else {
                System.out.println("do other stuff");

[/code]Not sure off the top of my head if you can block selection from there, though, or if you’ll simply have to reset the selection to its previous state if you go that route. If that alone or some combination with a ValueChangeListener or overriding Table’s setValue isn’t enough for your needs you’ll probably need to either extend VScrollTable and TableConnector or at least create a component extension for your table to do the event handling on the client-side. Also, if I recall correctly, if you have for example TextFields in some column within a Table, clicking on that field should automatically bypass the row selection, although clicking on any part of the cell that shows beyond the field itself does select the row.