PDA

View Full Version : Inconsistent dirty cell flag in grid numberfield editors?



lrayman
3 May 2013, 12:25 PM
Using ExtJS 4.2
I have an editable grid with a bunch of numeric fields. When I edit many of those fields in a row, some of the cells show the dirty flag, and some do not. The cells that do not show the dirty flag are always in the same columns - of the 4 numeric fields, the 1st 2 show the flag, and the rest do not.

All the fields below have been edited, but not all have the dirty flag:

43521

Any idea as to what I'm doing wrong?



selType: 'cellmodel',
plugins: [ 'cellediting' ],
columns: [
...
{ text: 'Text Fld 1', dataIndex: 'securityDesc', flex: 1, editor: 'textfield' },
{ text: 'Num Fld 1', dataIndex: 'maxQuantity', editor: {
xtype: 'numberfield',
minValue: 1,
allowDecimals: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}},
{ text: 'Num Fld 2', dataIndex: 'bid', editor: {
xtype: 'numberfield',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}},
{ text: 'Num Fld 3', dataIndex: 'Offer', editor: {
xtype: 'numberfield',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}},
{ text: 'Num Fld 4', dataIndex: 'Price', editor: {
xtype: 'numberfield',
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}},
{ text: 'Text Fld 2', dataIndex: 'collCurrency', editor: 'textfield' },
...
],

slemmon
6 May 2013, 11:53 AM
I tried with the below code and couldn't get it to fail on 4.2 or 4.2.1.818 Beta (latest Nightly).
Any chance it fails for you? If so, what ExtJS version are you on?



Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['a', 'b', 'c'],
data:{'items':[
{"a":1, "b":2, "c":3},
{"a":1, "b":2, "c":3},
{"a":1, "b":2, "c":3},
{"a":1, "b":2, "c":3}
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});


Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [{
name: 'a',
dataIndex: 'a',
editor: {
xtype: 'numberfield',
minValue: 1,
allowDecimals: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}
}, {
name: 'b',
dataIndex: 'b',
editor: {
xtype: 'numberfield',
minValue: 1,
allowDecimals: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}
}, {
name: 'c',
dataIndex: 'c',
editor: {
xtype: 'numberfield',
minValue: 1,
allowDecimals: false,
hideTrigger: true,
keyNavEnabled: false,
mouseWheelEnabled: false
}
}],
selType: 'cellmodel',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});

lrayman
6 May 2013, 12:01 PM
I just found the problem (he said with an embarrassed smile) - I had mistyped some of the dataindex names in the column setup. The badly set-up columns were the ones that didn't show the dirty flag.

thanks for reply

slemmon
6 May 2013, 12:34 PM
Ahh... it happens. :)
Glad you found the issue.

lrayman
7 May 2013, 5:31 AM
One more question:

Is there a debug setting that would have caught this error?
The editor code must have been calling get & set methods on the model with an invalid field. It wasn't raising any errors that I could see.

thanks again for the help

slemmon
7 May 2013, 8:19 AM
I'm not sure if it'd catch that particular error, but when developing if you're not using ext-dev.js for your library script do that.