Select/unselect all checkbox


I’ve been searching for answers for a small issue. I hope you can help me.
I have a grid in multiselect mode. If I click on the SELECT all checkbox (top left corner of the Grid), then all items get selected. Which is fine. But if I
deselect all items, the “SELECT ALL” checkbox, remains selected. I have a business requirement that demands that this checkbox must be unselected if all rows are manually unselected (doh!)

I tried a hack, something of this sort (im putting 2 approaches I tried, labed 1. and 2.).

                if(!tableSelected) {
                    1. ((SelectionModel.Multi) searchResultsTable.getSelectionModel()).reset();  
                    2. ((SelectionModel.Multi) searchResultsTable.getSelectionModel()).deselectAll(); 

I was hoping either of these two operations will unselect the SELECT ALL box, but with no luck. Does anybody know if this is possible as Vaadin’s Grid stands now?

Any help is much appreciated!