In the Extjs grid In the options, select from the combo box, it will remove the selection of all records from the grid

In Combo mode, select from the options, it will remove the selection of all records from the grid and even remove the selection of the current record when editing is completed.

  • Select all rows from the table.
  • click on the last cell of the column, it will show you a combo box for editing the cell, and at the same time, all other entries will be canceled , this is one of the problems.
  • Now select a value from the combo box and click on any other record or somewhere, you will notice that the edited row is also not selected

I am using 4.1. * Extjs and I tried to override the celledit plugin as well as CheckboxModel.

Is there a way to keep the records selected before and until I cancel it from the checkbox column.

Any help would be appreciated and thanks in advance

this is what i did on the violin

https://fiddle.sencha.com/#view/editor&fiddle/1u9i

+4
source share
1 answer

Hey man, I forked your fiddle and made some changes that I think solve your problem: https://fiddle.sencha.com/#view/editor&fiddle/27ua

viewConfig cellclick. cellclick ; cellIndex, , , . cellIndex, beforedeselect . , false beforedeselect, , 0.

:

var store = Ext.create('Ext.data.Store', {
    fields: ['name', 'email', 'region'],
    data: [{
        name: 'xyz',
        email: 'xyz@xyz.com',
        region: 'Arizona'
    }, {
        name: 'xyz',
        email: 'xyz@xyz.com',
        region: 'Alaska'
    }, {
        name: 'xyz',
        email: 'xyz@xyz.com',
        region: 'Alaska'
    }, {
        name: 'xyz',
        email: 'xyz@xyz.com',
        region: 'Alabama'
    }]
});
var states = Ext.create('Ext.data.Store', {
    fields: ['abbr', 'name'],
    data: [{
        "abbr": "AL",
        "name": "Alabama"
    }, {
        "abbr": "AK",
        "name": "Alaska"
    }, {
        "abbr": "AZ",
        "name": "Arizona"
    }]
});

var targetedCell = -1;
Ext.create('Ext.grid.Panel', {
    id: 'theGrid',
    viewConfig: {
        listeners: {
            cellclick: function(view, cell, cellIdx, record, row, rowIdx, eOpts) {
                targetedCell = cellIdx;
            }
        }
    },
    title: 'data',
    store: store,
    width: 400,
    renderTo: Ext.getBody(),
    selModel: new Ext.selection.CheckboxModel({
        checkOnly: true,
        listeners: {
            beforedeselect: function (thisSelModel, record, idx, eOpts) {
                if(targetedCell != 0) {
                    return false;
                }

                return true;
            }
        }
    }),
    columns: [{
        text: 'Name',
        dataIndex: 'name',

    }, {
        text: 'Email',
        dataIndex: 'email',
        flex: 1,

    }, {
        text: 'State',
        dataIndex: 'region',
        editor: {
            xtype: 'combo',
            store: states,
            displayField: 'name',
            valueField: 'name',
            listeners: {}
        }
    }],
    plugins: {
        ptype: 'cellediting',
        clicksToEdit: 1
    }

});
+1

Source: https://habr.com/ru/post/1675251/


All Articles