PDA

View Full Version : cell editing in grid with selModel: checkboxmodel



Prorok
10 Oct 2012, 11:01 AM
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:


Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
{ 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"marge@simpsons.com", "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()
});

Prorok
12 Oct 2012, 9:11 AM
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!

AustinAndrews
12 Oct 2012, 1:27 PM
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

alphimax
19 Dec 2012, 12:24 AM
Also need a solution for this one. Using 4.1.1

FCGus
22 Mar 2013, 10:05 AM
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.

Stju
7 Jul 2014, 4:18 PM
For 4.2.x


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);
}
}
});