PDA

View Full Version : [OPEN] CellEditing plugin changes row selection in editable grids



interconcept
8 May 2015, 6:43 AM
In an editable grid, I want that only clicking on the checkbox the row is selected, and not when clicking on the row itself (or on anything else). Thus:


selModel: new Ext.selection.CheckboxModel({
mode: 'MULTI',
checkOnly: true//so that on cell edit row selection is not affected
})

Beside that, I have some editable cells.

The problem is that on clicking on an cell to be edited, the row is selected (or better said, the selection is changed).

Fiddle for reproducing the bug:


Ext.application({
name : 'Fiddle',

launch : function() {
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone', 'sallary'],
data:{'items':[
{"name":"Lisa", "email":"[email protected]", "phone":"555-111-1224", "sallary" : 12.34},
{"name":"Bart", "email":"[email protected]", "phone":"555-222-1234", "sallary" : 12.34},
{"name":"Homer", "email":"[email protected]", "phone":"555-222-1244", "sallary" : 12.34},
{"name":"Marge", "email":"[email protected]", "phone":"555-222-1254", "sallary" : 12.34}
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});

Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{header: 'Name', dataIndex: 'name', editor: 'textfield'},
{header: 'Email', dataIndex: 'email', flex:1,
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
}
},
{header: 'Phone', dataIndex: 'phone'},
{header: 'Sallary', dataIndex: 'sallary', flex:1,
renderer: function(value) {
if (value == null) {
return "";
} else {
return Ext.util.Format.currency(value, undefined, 2, true);
}
},
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 0,
selectOnFocus: true
}
},
],
selModel: new Ext.selection.CheckboxModel({
mode: 'MULTI',
checkOnly: true//so that on cell edit row selection is not affected
}),
plugins: {
ptype: 'cellediting',
clicksToEdit: 1
},
height: 200,
width: 400,
renderTo: Ext.getBody()
});
}
});


Affected version (tested with the Gray theme): ExtJs 4.2.1 and 4.2.3 (you cannot reproduce it on Linux with Firefox, but with [email protected] or [email protected] you can reproduce it).

Is there an workaround for this?

PS: In ExtJS 5.1 the problem is generally only that on the first click (when no row at all is selected) the row gets selected.

tristan.lee
8 May 2015, 11:31 AM
Thank you for reporting this. I have filed this as a bug to be fixed in our next release in ExtJS 4. As of now, I do not have a workaround.