GIGJ.COM
welcome to my space
X
Search:  
Welcome to:gigj.com
NAVIGATION - HOME
CheckboxSelectionModel: how to set header unchecked
Published by: smith 2010-03-15
  • [2.1] "Smart" CheckBoxSelectionModel (v1.7 2008-07-01) - Ext JS Forums::
    If set to true, * all other rows will be deselected and unchecked except the row .. and a CheckboxSelectionModel (header check all/uncheck all) and the
    http://yui-ext.com/forum/showthread.php?t=37588
    HOME
    Hi there,

    I tried to clear all selections in my grid by calling clearSelections().
    But the header itself is not set unchecked by that function.

    How can I do that?

    Greetings
    Bionique


  • Yes of course, but it calls deselectRow and deselectRow fires the selectionchange-event. That's why I suggested you to put the function into the listener config option of the selection model.
    Please post your relevant code, that I can take a look on it.


  • But why do you want to set the header unchecked alone? In your first post you mentioned that you want to call 'clearSelections()'. JUST DO IT and the header becomes unchecked by the listener function. You don't need to handle the headercheckbox itself anymore.
    Try it!

    To clear all selections on load event use

    yourStore.on('load', function() {
    yourGrid.getSelectionModel().clearSelections();
    });

    or something like this...


  • In my app it works fine.
    Can you post your code, please?


  • I didn't think about a smart solution. Just set the header property to an other value than the default one (empty div, empty string or something like this).
  • 我的博客- liguisheng_002 - 网易博客::
    55 var sm = new Ext.grid.CheckboxSelectionModel(); // add checkbox column. 56 var cm = new Ext.grid.ColumnModel([nm,sm,. 57 {id:'PROJECT_NO',header:"项目
    http://blog.163.com/liguisheng_002/
    HOME


  • Create a new CheckboxSelectionModel like this one:

    var sm = new Ext.grid.CheckboxSelectionModel({
    listeners: {
    'selectionchange': function() {
    var hd = Ext.fly(this.grid.getView().innerHd).child('div.x-grid3-hd-checker');
    if (this.getCount() < this.grid.getStore().getCount()) {
    CheckboxSelectionModel: how to set header unchecked - Page 2 - Ext ::
    Page 2-CheckboxSelectionModel: how to set header unchecked Ext: Help. RowSelectionModel knows nothing about a header-field to set.
    http://extjs.com/forum/showthread.php?t=50266&page=2
    HOME
    CheckboxSelectionModel: how to set header unchecked - Ext JS Forums::
    CheckboxSelectionModel: how to set header unchecked Ext: Help. But what I want is to to set the header unchecked initially, after the store has been
    http://extjs.com/forum/showthread.php?t=50266
    HOME
    hd.removeClass('x-grid3-hd-checker-on');
    } else {
    hd.addClass('x-grid3-hd-checker-on');
    }
    }
    }
    });

    Every time the selection changes, the function checks whether the headercheckbox should be checked or not.
    The headercheckbox only becomes checked if all rows of your grid are checked, too.
    So it becomes even checked if you select all rows manually.


  • Ok, now I understand. A hard peace of work... ;)
    I tried your code for the selectionchanged, and it works. :)

    Thank you very much for your effort and time.


  • CheckboxSelectionModel extends RowSelectionModel.
    It seems to me that only RowSelectionModel got that clearSelections() and it works for normal RowSelectionModel (without header-stuff). And CheckboxSelectionModel has no own clearSelections(). But I'm not sure about that.


  • Sure, but if CheckboxSelectionModel extends RowSelectionModel it inherits all functions. If CheckBoxSelectionModel doesn't have an own clearSelections, the function of RowSelectionModel is used.


  • I put this

    var hd = Ext.fly(this.grid.getView().innerHd).child('div.x-grid3-hd-checker');
    if (this.getCount() < this.grid.getStore().getCount()) {
    hd.removeClass('x-grid3-hd-checker-on');
    } else {
    hd.addClass('x-grid3-hd-checker-on');
    }

    into the 'selectionchange'-event of the selection model


  • Hi,
    I am using a new xg.CheckboxSelectionModel({singleSelect:true})

    But, even though it allows only single row to be selected at any given time, the checkbox column header still contains the 'check all' checkbox ! which is very confusing.

    Is there a way to not display this 'check all' header ? (for single select option/otherwise)


  • But have U seen what clearselections() does?


    clearSelections : function(fast){
    if(this.locked) return;
    if(fast !== true){
    var ds = this.grid.store;
    var s = this.selections;
    s.each(function(r){
    this.deselectRow(ds.indexOfId(r.id));
    }, this);
    s.clear();
    }else{
    this.selections.clear();
    }
    this.last = false;
    },


    RowSelectionModel knows nothing about a header-field to set. Because its CheckboxSelectionModel specific.


  • Ok, now I understand. :)
    But what I want is to to set the header unchecked initially, after the store has been loaded/refreshed. (If I checked the header before loading, it stays in the checked-state)

    I thought I can add a load-listener (for the store) and set the header unchecked.
    Is that possible?


  • I'm sorry. I don't understand what this should do. :(


  • That's what I tried. I called clearSelections(), but result is: only the rows are de-selected, the header is still checked.





  • Nortel Unveils Vision, Strategy for Israeli High-Performance Net
    Busy Friday Leads to Strong Close for Net Stocks
    #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about CheckboxSelectionModel: how to set header unchecked , Please add it free.

    Suggested articles

  • how has a supernova explosion been seen in broad daylight from a distance of 7 500 ly away
  • has there been much research on induced amnesia through electronic or pharmaceutical means
  • why don 039 t radio telescope facilities offer to send personal messages to raise funds for their project
  • why is the largest possible star 2600 times larger than our sun
  • what is the lethal range of 22 handgun and same for rifle
  • can a psychic medium or clairvoyant help will my boyfriend repay the money he stole from me
  • why would water boil immediately on mars
  • is there a psychic clairvoyant or medium who can help i lost my rent money who should i ask to help
  • does anyone know any sites where it tells you what to look out for in the night sky every month
  • poll what is your favorite quote from a funny movie
  • light year and and relative age of stars
  • who is your favorite ufologist
  • is traveling to the sun like in sunshine the movie even relatively possible
  • to stop the rising water levels would it be possible to send salt water into space


  • About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
    Copyright© 2008 gigj.com All Rights Reserved
    Site made&Support support@gigj.com    E-mail: web@gigj.com