Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Disable Checkboxes in CheckBoxListView

  1. #11
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    77

    Default

    The listener + locked approach works fine, but the view has an enabled look. That means the user is "invited" to click there.

    It looks like the final solution was to use the listener + locked and apply the mask after the view (well, the store) is populated with data.

    Thanks,

    Dan

  2. #12
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    In the endthe code looks like this:
    Code:
     view.addListener(Events.Refresh, new Listener<ListViewEvent<BeanModel>>() {
         public void handleEvent(ListViewEvent<BeanModel> e) {
           view.mask("disabled");
         }
       });
       view.disable();
    I tested it and it works for me

    When the view is masked, you dont need to look at as all events get captured by the mask

  3. #13
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    77

    Default

    Something similar works, indeed.

    Thanks,

    Dan

  4. #14
    Ext GWT Premium Member
    Join Date
    Jun 2010
    Posts
    47

    Default

    Is there a way to also disabled the entire list (make it look grey-out)? when I try to disable the listView, then the user is able to actually select/unselect the check-boxes in the list

  5. #15
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    I added a change to CheckBoxListView that will prevent clicking the checkboxes when the view is disabled. This change is already in SVN.

  6. #16
    Ext GWT Premium Member
    Join Date
    Jun 2010
    Posts
    47

    Default

    Can you elaborate what is the change you have made? I do not wish to checkout the code from trunk, so I will do the modification myself.

  7. #17
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    The change will also be part of GXT 2.2.1. The change i did is explained in this thread. I prevent the default action of the click event, see post #6

  8. #18
    Sencha User
    Join Date
    Oct 2010
    Posts
    37

    Default

    I will stick to this thread as I have a similar question. How would you disable single checkbox, or single entry, depending on the values of properties of the ModelData instances? Any ideas?

  9. #19
    Sencha User
    Join Date
    Oct 2010
    Posts
    37

    Default

    In case anyone is interested, here is the way I did this. I simply overrided refresh method:

    Code:
    @Override
    public void refresh() {
      super.refresh();
    
      if (rendered) {
        NodeList<Element> nodes = el().select(this.getCheckBoxSelector());
        for (int i = 0; i < nodes.getLength(); i++) {
          Element e = nodes.getItem(i);
          if (InputElement.is(e)) {
            InputElement ie = InputElement.as(e);
                
            ModelData md = store.getAt(i);
            if(YOUR_CONDITION) {
              ie.setDisabled(true);
            }
        }
      }
    }

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •