Results 1 to 4 of 4

Thread: CheckBox - Select all checkbox of a checkboxgroup

  1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216
    Vote Rating
    1
      0  

    Default CheckBox - Select all checkbox of a checkboxgroup

    Hello,

    I have a checkboxgroup with a couple of checkbox, what I would like to do is when the first box is checked the others should be checked too but I have no idea how to proceed to achieve that.

    What I've done so far is to use a listener and I guess in my checkAll() function I should retrieve all the checkbox of the group but I don't know how to do.

    Thanks for giving me some information to do that.

    Code:
    {
        layout: 'column',
        items: [
        {
          columnWidth: .1,
          border: 'true',
          layout: 'fit',
          items: 
          {
            xtype: 'checkboxgroup',
            id: 'group-D',
            columns: 1,
            items: [
            {    boxLabel: '<b>D</b>', 
                name: 'D',
                listeners: {
                        check: checkAll
                }
            },
            {    
                boxLabel: 'D1', 
                name: 'D1'
            },
            {    
                boxLabel: 'D2', 
                name: 'D2'
            },
            {    
                boxLabel: 'D3', 
                name: 'D3'
            },
            {    
                boxLabel: 'D4', 
                name: 'D4'
            }
            ]
            }
           }

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    132
      0  

    Default

    You could use:
    Code:
    function checkAll(cb, checked){
      var group = Ext.getCmp('group-D');
      group.eachItem(function(item){
        item.setValue(checked);
      });
    }
    Disclaimer: Completely untested code!

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Belgium
    Posts
    216
    Vote Rating
    1
      0  

    Thumbs up RESOLVED

    Thanks again Condor

  4. #4
    Sencha User
    Join Date
    Dec 2008
    Location
    France
    Posts
    319
    Vote Rating
    2
      0  

    Default

    If you come here, here is the code for Ext 6.6.0

    Code:
    function checkAll(cb, checked){
         var group = Ext.getCmp('id_annuadCheckAlphabet');
         group.eachBox(function(item){
              item.setValue(newValue);
         });
    }

Similar Threads

  1. Replies: 2
    Last Post: 8 Nov 2010, 10:07 AM
  2. Add checkbox to checkboxgroup at runtime
    By enickma in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 27 Jul 2010, 6:34 PM
  3. How to set value on a checkbox in a checkboxGroup
    By damnos in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 27 Jun 2009, 6:07 AM
  4. Checkbox/CheckboxGroup layout?
    By TheBuzzer in forum Community Discussion
    Replies: 3
    Last Post: 22 Aug 2008, 1:43 PM
  5. Checkbox labels in Checkboxgroup wrapping
    By glimjack in forum Ext 2.x: Help & Discussion
    Replies: 18
    Last Post: 6 Aug 2008, 6:36 PM

Posting Permissions

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