1. #1
    Sencha User
    Join Date
    Oct 2012
    Location
    Bangalore,India
    Posts
    12
    Vote Rating
    0
    shashankbs086 is on a distinguished road

      0  

    Default Answered: Get the number of checked columns for 'checkcolumn' xtype

    Answered: Get the number of checked columns for 'checkcolumn' xtype


    Hello,

    I am not able to get the number of checkboxes checked in a grid which has a column of xtype 'checkcolumn'.
    Is it possible to get the count of checkboxes checked in the xtype 'checkcolumn'.



    thanks in advance

  2. Since it's bound to a column, you can also do something like:

    Code:
    var count = 0;
    store.each(function(rec){
        count += rec.get('foo') ? 1 : 0;
    });
    Or possibly even (since it should coerce the bools to ints):
    Code:
    var count = store.sum('foo');

  3. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,913
    Answers
    371
    Vote Rating
    179
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    There's not a convenience method for getting a count, but there is a checkchanged event that is raised each time a cell is checked/unchecked. You could listen for the event and keep a tally running that way.

  4. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Answers
    453
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      1  

    Default


    Since it's bound to a column, you can also do something like:

    Code:
    var count = 0;
    store.each(function(rec){
        count += rec.get('foo') ? 1 : 0;
    });
    Or possibly even (since it should coerce the bools to ints):
    Code:
    var count = store.sum('foo');
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #4
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default grid.getSelectionModel().getSelection();

    grid.getSelectionModel().getSelection();


    Code:
    var grid = Ext.getCmp('YourGridName');
    var selection = grid.getSelectionModel().getSelection();
    if (selection.length > 0){    
            if (selection.length == 1){ /* this line does what you need
                 /* Do somthing    */
            }
            else{
               /* Do somthing    */
            }        
        }
    }
    Thanks

  6. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Answers
    453
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    It's worth noting that 'checkcolumn' and 'checkboxmodel' are not the same thing here.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  7. #6
    Sencha User
    Join Date
    Oct 2012
    Location
    Bangalore,India
    Posts
    12
    Vote Rating
    0
    shashankbs086 is on a distinguished road

      0  

    Default


    Thanks a lot Evant, Your code just worked like a charm

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi