0
votes

I am using GridPanel with checkbox selection model. I have a column rendered as textfield for user to input quantity. The problem is, as soon as I entered a value for one item, the checkbox of previous row is deselected even though i set true for 'checkOnly'

Below is my gridpanel

Ext.define('demo.view.productsGridPanel', {
extend : 'Ext.grid.Panel',
alias : 'widget.productsGridPanel',


selModel: Ext.create('Ext.selection.CheckboxModel', {
                        mode: 'MULTI', 
                        checkOnly: true
            }),

plugins: [
    Ext.create('Ext.grid.plugin.CellEditing', {
        clicksToEdit: 1
    })
],



initComponent : function() {

    var me = this;

    this.store = Ext.StoreManager.get('demo.store.Products');

    this.columns = [ 
        {
            header : 'Product Code',
            dataIndex : 'code',
            flex : 1
        }, 
        {
            header : 'Product Name',
            dataIndex : 'name',
            flex : 2
        }, 
        {
            header : 'Product Price',
            dataIndex : 'price',
            flex : 1
        },
        {
             header: 'Enter Qty',               
             flex: 1,
             dataIndex : 'quantity',
             editor: {
                    xtype: 'textfield',
                    allowBlank: true
             }
        },

    ];



    this.callParent(arguments);
}

});

Any help would be appreciated.

1

1 Answers

0
votes

I've converted your code into a Sencha Fiddle and cannot replicate the issue that you are having. The error that you are getting must be caused by something else. Are you seeing an errors in your browser console when running this?

Update: I've noticed that the error occurs when entering the editable text field. On entering the field the checkboxes are deselected execpt for that row.

This was a known bug in ExtJs version 4.0.7 and was supposedly fixed in later versions, although it doesnt appear to be fixed in any version. A temporary bugfix can be found on HERE on GitHub and a demo of it in use is in the above fiddle but it only seems to work for ExtJs version 4.0.7.

I would post this on the Sencha forums as a bug so that can re-investigate the issue.

I will look into the issue further and let you know if I come up with a better solution. I've just tested this in ExtJS 5 and it works without issues.