Results 1 to 6 of 6

Thread: cell editing in grid with selModel: checkboxmodel

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    9

    Default cell editing in grid with selModel: checkboxmodel

    Hi!
    I have grid with selModel : CheckboxModel and cellediting plugin.
    If I select several items and try editing cell Name, all selected items are deselected, this is normal behavior?
    and how can I prevent this?

    Ext version tested:
    • Ext 4.1.1

    Test Case:

    Code:
    Ext.create('Ext.data.Store', {
        storeId:'simpsonsStore',
        fields:['name', 'email', 'phone'],
        data:{'items':[
            { 'name': 'Lisa',  "email":"[email protected]",  "phone":"555-111-1224"  },
            { 'name': 'Bart',  "email":"[email protected]",  "phone":"555-222-1234" },
            { 'name': 'Homer', "email":"[email protected]",  "phone":"555-222-1244"  },
            { 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254"  }
        ]},
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });
    
    Ext.create('Ext.grid.Panel', {
        title: 'Simpsons',
        store: Ext.data.StoreManager.lookup('simpsonsStore'),
        columns: [
            { text: 'Name',  dataIndex: 'name', editor: { xtype: 'textfield'} },
            { text: 'Email', dataIndex: 'email', flex: 1 },
            { text: 'Phone', dataIndex: 'phone' }
        ],
        height: 200,
        width: 400,
        plugins: [{ptype: 'cellediting', clicksToEdit: 1}],
        selModel: Ext.create('Ext.selection.CheckboxModel'),
        renderTo: Ext.getBody()
    });

  2. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    9

    Default

    In version 4.1.0, 4.0.7 with selModel: Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }), everything works well but without checkOnly: true in 4.1.2, 4.1.1, 4.1.0, 4.0.7 we have unexpected behavior.
    even with checkOnly: true in 4.1.2, 4.1.1 we have this issue.
    it looks like a bug!

  3. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    13
    Answers
    1

    Default I can reproduce it.

    Definitely can reproduce. When the row is edited, the row is selected, and all other rows are deselected.


    Hopefully we see a fix soon, seems minor, but I don't have a workaround at the moment.

    // edit,

    checkOnly : true,
    mode: 'multi',
    selectByPosition : Ext.emptyFn // workaround; EXTJSIV-7110

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    8

    Default

    Also need a solution for this one. Using 4.1.1

  5. #5
    Ext JS Premium Member
    Join Date
    Mar 2010
    Posts
    22

    Default

    I posted also a message in a similar post, sorry for the multiple posts but this is something that hopefully there is some type of workaround...In a few posting that I have encountered no solution has been suggested and it is causing a few issues.
    Using 4.1.1, editable grid, tabbing over editable cells is causing the row to be selected (check box is checked) something that needs to be done only when the user manually clicks on the selection check box.

    Thanks.

  6. #6
    Sencha - Services Team Stju's Avatar
    Join Date
    Dec 2008
    Location
    Redwood city, California
    Posts
    293
    Answers
    2

    Default

    For 4.2.x
    Code:
    var cellEditing = new Ext.grid.plugin.CellEditing({
                clicksToEdit: 2,
        /**
         * preventSlection {Boolean} Setting to true will prevent selection of current record
         */
        preventSelection: true
    });
    
    
       
    Ext.define('Override.Ext.selection.RowModel', {
        override:'Ext.selection.RowModel',
        selectByPosition: function(position) {
           
            var context = new Ext.grid.CellContext(this.view),
                plugin = this.view.editingPlugin;
                
            context.setPosition(position.row, position.column);
            if(!plugin || (plugin.ptype == 'cellediting' && !plugin.preventSelection)){
                this.select(context.record);
            }
        }
    });

Posting Permissions

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