Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    16
    Vote Rating
    0
    kurasp is on a distinguished road

      0  

    Default Ext.selection.CheckboxModel's checkOnly: true not working

    Ext.selection.CheckboxModel's checkOnly: true not working


    REQUIRED INFORMATION




    Ext version tested:
    • Ext 4.1.1
    Browser versions tested against:
    • Chrome
    • IE9
    DOCTYPE tested against:


    Description:
    • The checkbox selection model's checkOnly field is not working when the grid is also set up with the cell editing plugin. When a cell is clicked, the checkbox is checked.
    Steps to reproduce the problem:
    • Create a grid with the checkboxmodel (Ext.selection.CheckboxModel) where checkOnly is set to true and the cell editing plugin (Ext.grid.plugin.CellEditing).
    • Set one of the columns as editable "editor: 'textfield',"
    • Click in the editable cell and the checkbox will be checked
    The result that was expected:
    • Checkbox should not be checked. This was the case in extjs versions 4.0.7 and 4.1.0
    The result that occurs instead:
    • Checkbox is checked
    Test Case:


    Code:
    Ext.onReady(function() {
      
        var heightMainPanel = 600;
        var heightGrid = 200;
        var heightForm = 200;
        var widthMainPanel = 775;
    
    
        Ext.define('TestResult', {
            extend: 'Ext.data.Model',
            fields:
            [
                'student',
                {
                    name: 'mark',
                    type: 'int'
                }
            ]
        });
      
        var myStore = Ext.create('Ext.data.Store', {
            storeId: 'myStore', // needed to add items to grid
            model: 'TestResult',
            data: [
                {
                    student: 'Student 1',
                    mark: 84
                }, {
                    student: 'Student 2',
                    mark: 72
                }, {
                    student: 'Student 3',
                    mark: 96
                }, {
                    student: 'Student 4',
                    mark: 68
                }
            ]
        });
      
        Ext.define('myGridPanel', {
            extend: 'Ext.grid.Panel',
            initComponent:function()
            {
                var me = this;
                Ext.apply(me,
                {
                    height: heightGrid,
                    frame : false
                });
                me.features = [{ftype: 'summary'}];
                me.plugins = Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1});
                me.selModel = Ext.create('Ext.selection.CheckboxModel', {checkOnly: true});
                me.columns = [
                {
                    dataIndex: 'student',
                    text: 'Name',
                    editor:         'textfield',
                    summaryType: 'count',
                    summaryRenderer: function(value, summaryData, dataIndex)
                    {
                        return Ext.String.format('{0} student{1}', value, value !== 1 ? 's' : '');
                    }
                },
                {
                    dataIndex: 'mark',
                    text: 'Mark',
                    summaryType: 'sum'
                }
                ];
                me.callParent(arguments);
            }
        });
    
    
        var gridPanel = Ext.create('myGridPanel', {store: myStore});
        
        var mainPanel = Ext.create('Ext.panel.Panel',{
            items:
            [
                gridPanel
            ],
            renderTo: document.body
        });
    
    
    });





    HELPFUL INFORMATION




    Screenshot or Video:
    • attached
    See this URL for live test case: http://jsfiddle.net/kurasp/mbc9e/1/




    Debugging already done:
    • none
    Possible fix:
    • not provided
    Additional CSS used:
    • only default ext-all.css
    Operating System:
    • Windows 7

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      1  

    Default


    Looks like the cell editing plugin is causing the issue here.

    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    16
    Vote Rating
    0
    kurasp is on a distinguished road

      0  

    Default


    You're right Mitchell, it appears to be caused by CellEditing's showEditor function. where it calls: i.selectByPosition({row: c.rowIdx, column: c.colIdx}), do you know why this was added. As a workaroun, I can override the function and comment out the line, but want to make sure it doesn't break some other functionality.

    Cheers,
    Pawel

Thread Participants: 1