PDA

View Full Version : Overriding the behavior for checkbox column header



ssinai
13 Oct 2011, 11:57 AM
I have a grid that's several hundred rows. I'm using a PagingToolBar to page through the grid, where each page is about 30 rows. One of the columns uses a CheckBoxSelectionModel, which displays checkboxes for each row in that column, and in the header for that column.

I need to override the default behavior of the checkbox in the column header. The default behavior is that the header checkbox is selected if all the rows on the currently visible page are selected, and it's deselected if one or more of the currently visible row checkboxes is deselected.

What I need is for the header checkbox to be deselected if any of the rows on any of the pages is deselected - not just those on the visible page.

I'd like to be able to override the CheckBoxSelectionModel's updateHeaderCheckBox() and setChecked(boolean checked) methods so that I can control whether the checkbox in the column header is checked or not. Unfortunately, both those methods are declared private, so I can't override their behavior.

Anyone have any suggestions as to how I can override the default behavior in order to control the header checkboxes for the grid?

Thanks.