1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    16
    Vote Rating
    -1
    Answers
    2
    ssinai is an unknown quantity at this point

      0  

    Default Answered: Detecting the value of a checkbox in a grid header

    Answered: Detecting the value of a checkbox in a grid header


    I'm using a CheckboxSelectionModel to create a column of checkboxes in a grid.

    I'm using the onHeaderClick(GridEvent<M> se) method to detect when the checkbox in the column header is clicked, but I can't figure out how to detect whether the header checkbox was just selected or deselected. Does anyone know how to do this?

  2. Hi. If you check the onHeaderClick implementation, you will see how it checks that:

    Code:
    protected void onHeaderClick(GridEvent<M> e) {
          El hd = e.getTargetEl().getParent();
          boolean isChecked = hd.hasStyleName("x-grid3-hd-checker-on");
    .....

  3. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    868
    Vote Rating
    1
    Answers
    9
    micgala is on a distinguished road

      0  

    Default


    Hi. If you check the onHeaderClick implementation, you will see how it checks that:

    Code:
    protected void onHeaderClick(GridEvent<M> e) {
          El hd = e.getTargetEl().getParent();
          boolean isChecked = hd.hasStyleName("x-grid3-hd-checker-on");
    .....

  4. #3
    Sencha User
    Join Date
    Jul 2010
    Posts
    16
    Vote Rating
    -1
    Answers
    2
    ssinai is an unknown quantity at this point

      0  

    Default


    Thanks. Now I need to be able to override the CheckedBoxSelectionModel'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.

    The issue is that I have a grid spread across several pages, and use a PagingToolBar to move between pages. The column header checkbox for a particular page is deselected if any of the checkboxes in the grid on the current page are deselected, but I need to be able to deselect the header checkbox if a checkbox on any page is deselected - not just the visible page.

    If those two methods were declared protected or public rather than private, I'd be in good shape. The private declarations are really screwing me up.

Thread Participants: 1