1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    50
    Answers
    1
    Vote Rating
    2
    vicvolk87 is on a distinguished road

      0  

    Default Answered: How to lock checkbox column?

    Answered: How to lock checkbox column?


    Hello, Sencha-guys!) Please help, I'm in truble. I guess there should be a simple solution to my problem. I have a grid with a checkbox model. Is it possible to lock this column? The grid can contain many-many columns and sometimes the user has to scroll to the right to see something and depending on the data this user may or may not check the row. So he has to scroll back to do this. Just clicking on the row is not a way out, because cells may be editable or contain some hypertext.

  2. I believe you'll need to create an overrride for the checkbox selection model. If you look at the private getHeaderConfig method you can see where locking is set on the column header config.

    There is a request in for the header to be optionally locked (outside of having locked peers) in the feature request queue internally, so perhaps in some future build that will be a public config option.

  3. #2
    Touch Premium Member
    Join Date
    Mar 2011
    Posts
    120
    Answers
    14
    Vote Rating
    7
    chamacs is on a distinguished road

      0  

    Default


    Available since 4.1.1, grid panel columns have a locked:true attribute:
    http://docs.sencha.com/extjs/4.1.1/#!/api/Ext.grid.column.Column-cfg-locked

    Is this what you're looking for?

  4. #3
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    50
    Answers
    1
    Vote Rating
    2
    vicvolk87 is on a distinguished road

      0  

    Default


    Hi, chamacs!
    I tried to use this property in this way

    Code:
    var selModel=Ext.create('Ext.selection.CheckboxModel',{
            locked   : true
     });
    But it leads to an error.

  5. #4
    Touch Premium Member
    Join Date
    Mar 2011
    Posts
    120
    Answers
    14
    Vote Rating
    7
    chamacs is on a distinguished road

      0  

    Default


    The attribute needs to be put on the column config, not the selection model. What is it you're trying to do? This attribute will lock the column in place so scrolling to the right will not move the column.

    psuedo example:
    Code:
    Ext.create('Ext.grid.Panel', {
      store : // your store ref
      columns: [{
        text: 'Name',
        dataIndex: 'name',
        locked : true,
        width : 100
      }, {
        text: 'Email',
        dataIndex: 'email',
        flex : 1
      }]
    });

  6. #5
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    50
    Answers
    1
    Vote Rating
    2
    vicvolk87 is on a distinguished road

      0  

    Default


    This is the minified version of the code I have. What I want is to lock the very first checkbox column added by the model. It is not present inside "columns" block. So, I can't use "locked:true" just in a standard manner.

    Code:
    var selModel=Ext.create('Ext.selection.CheckboxModel',{});
    var grid = Ext.create('Ext.grid.Panel', {
            store: store,
            selModel: selModel,
            columnLines: true,
            columns: [{
                text     : 'Company Name',
                dataIndex: 'company'
            },{
                text     : 'Price',
                dataIndex: 'price'
            }]
    });

  7. #6
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    50
    Answers
    1
    Vote Rating
    2
    vicvolk87 is on a distinguished road

      0  

    Default


    I want to lock this column, marked by an arrow. This makes sense, when there is too much columns in a grid. And the user wants to check a particular row, depending on the data somewhere to the right of the grid.

    lock.jpg

  8. #7
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,993
    Answers
    380
    Vote Rating
    183
    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

      1  

    Default


    I believe you'll need to create an overrride for the checkbox selection model. If you look at the private getHeaderConfig method you can see where locking is set on the column header config.

    There is a request in for the header to be optionally locked (outside of having locked peers) in the feature request queue internally, so perhaps in some future build that will be a public config option.
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

Thread Participants: 2