PDA

View Full Version : [INFOREQ] setValue() method doesn't work in rowEditing's beforeedit event



hexawing
8 Nov 2011, 7:21 PM
REQUIRED INFORMATION
Ext version tested:

Ext 4.0.2 4.0.7

Browser versions tested against:

FF6.0.2 (firebug 1.8.4 installed)

DOCTYPE tested against:

____

Description:

When I set a value to a cell in the "beforeedit" event of rowEditing plugin, it doen's work, but if I run the same code in the "change" event of another cell, it works.

Steps to reproduce the problem:

dbclick to edit the grid's line 1

The result that was expected:

line 1 cell 2 was set to "3" and disabled

The result that occurs instead:

line 1 cell 2 was disabled but its value remains

Steps to reproduce the problem:

edit the grid's line 1 cell 1 to any other value

The result that was expected:

line 1 cell 2 was set to "3" and disabled

The result that occurs instead:

as expected

Test Case:
var quoteItemRowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2,
autoCancel: false,
listeners: {
beforeedit: function(){
Ext.getCmp('col_email').getEditor().setValue("3");
Ext.getCmp('col_email').getEditor().setDisabled(true);
}
}
});

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'),
plugins: [quoteItemRowEditing],
columns: [
{
header: 'Name',
id: 'col_name',
dataIndex: 'name',
editor: {
listeners: {
change: function(){
Ext.getCmp('col_email').getEditor().setValue("3");
}
}
}},
{
header: 'Email',
id: 'col_email',
dataIndex: 'email',
flex: 1,
editor: {}},
{
header: 'Phone',
id: 'col_phone',
dataIndex: 'phone'}
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
HELPFUL INFORMATION Screenshot or Video:



See this URL for live test case: http://jsfiddle.net/hexawing/mf2jH/9/ Debugging already done:

none

Possible fix:

not provided

Additional CSS used:

only default ext-all.css

Operating System:


WinXP Pro

mitchellsimoens
9 Nov 2011, 6:11 AM
I changed Ext JS version to 4.0.7. I started an edit and the email did not change. I edited the Name field and it changed the email value. This done on the Marge row.

ssh_hameed
26 Nov 2013, 4:28 AM
beforeedit: function(editor, e){

e.record.set('email' , '3');

}