Results 1 to 7 of 7

Thread: How to lock checkbox column?

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Posts
    54
    Answers
    1
    Vote Rating
    2
      0  

    Default 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
    Sencha Premium User
    Join Date
    Mar 2011
    Posts
    287
    Answers
    35
    Vote Rating
    46
      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
    54
    Answers
    1
    Vote Rating
    2
      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
    Sencha Premium User
    Join Date
    Mar 2011
    Posts
    287
    Answers
    35
    Vote Rating
    46
      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
    54
    Answers
    1
    Vote Rating
    2
      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
    54
    Answers
    1
    Vote Rating
    2
      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 - Documentation Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,162
    Answers
    501
    Vote Rating
    257
      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 human resources manager: fabienne.bell@sencha.com

Posting Permissions

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