Search code examples
extjsextjs4

Single Selection not working in Extjs Grid


This is how I set up my selection model for my grid :

var selM = Ext.create('Ext.selection.Model', {
    mode: 'SINGLE',
    toggleOnClick: true,
    allowDeselect:true
});

And then in my table I add this as a configuration paramater :

var packageGrid = Ext.create('js.grid.MyGrid', {
    selModel: selM 
});

The MULTI selection is disabled, which is great. However now nothing remains selected. If I click on a row the highlighting disappears as soon as I move the mouse away.

This could be an extjs bug. I have tried the other parameter 'SIMPLE' as well.

Here is a fiddle which shows my problem :

http://jsfiddle.net/fgkb8yw5/1/


Solution

  • RowModel is the default so you can simply use:

    selModel: {
      mode: 'SINGLE'
    }
    

    Example: http://jsfiddle.net/8mra2het/1/