PDA

View Full Version : Grid cell defaulting to old value on cell click



Roger_John
6 Feb 2015, 5:33 AM
Brief Description : We have an editable grid. We insert a new row --> edit its cell in 1st column. Again insert a new row--> on clicking the cell for the newly inserted row for that particular column (1st in this example). The data which was entered in the previously inserted row is getting defaulted in the newly inserted row.


Detailed Description: We have a combo box inside grid, the store FruitNameStore contains all the list of fruits from which we can select a fruit and save. The store for grid is FruitTypes.
The scenario here is we insert a row in the grid and select Fruit Name, Again insert a new row and simply click on the cell of the inserted row, the data in previously inserted row is getting defaulted to the newly inserted row. Please note that this happens for other grids also, which does not have cellclick event.




{
xtype : 'fieldset',
name: 'FruitStoreField',
flex : 1,
margin : '0 5 0 0',
minHeight: 200,
maxHeight:208,


layout : {
type: 'vbox',
align: 'left',
align: 'stretch'
},
title: 'Fruits Information',
defaults : {
flex: 1
},


items : [ {


margin : '0 0 0 0',
xtype : 'grid',
autoHeight: true,
reference:'gdFruitTypeGrid',
cls:'classgdFruitTypeGrid',
name:'gdFruitTypeGrid',
itemId:'gdFruitTypeGrid',
modelValidation: true,
bind: {
store: '{FruitTypes}'
},
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit : 1,
listeners: {
afteredit: 'onAfterEditFruitType',
beforeedit: 'onBeforeEditFruitType'
}
})
],
columns : [
{
header: '<span style="display:inline-block; text-align:center;">Option<br>No</span>',
align: 'center',
flex:2.5,
xtype: 'rownumberer'
}, {
text: '<span style="display:inline-block; text-align:center;">Fruit Name<br>Type</span>',
dataIndex: 'FruitCd',
itemId:'ddgridFruitType',
name: 'gridFruitType',
align: 'center',
flex:3.0,
visible: true,
reference : 'ddgridFruitType',
editor: {
dataIndex: 'FruitCd',
xtype: 'combo',
queryMode: 'local',
triggerCls: 'classddgridFruitType',
typeAhead: true,
fieldStyle:'text-transform:uppercase',
store: Ext.getStore('FruitNameStore'),
tpl: Ext.create('Ext.XTemplate',
'<div class="selfContained"><table cellspacing=0 width=100%>',
'<tpl for=".">',
'<tr valign=top height="30px" title="{FruitCd}" class="x-boundlist-item">',
'<td>{FruitCd}</td>',
'<td>&nbsp;&nbsp;&nbsp;</td>',
'<td border="true" >{FruitCdDesc}</td>',
'</tr>',
'</tpl>',
'</table></div>'
),
displayTpl: Ext.create('Ext.XTemplate',
'<tpl for=".">',
'{FruitCd}',
'</tpl>'
),
selectOnFocus : true,
displayField : 'FruitCd',
valueField : 'FruitCd',
matchFieldWidth : false,
maxLength: 6,
enforceMaxLength:true,
listConfig:{
width : 300,
minHeight: 150,
maxHeight: 150
},
editable: true,
listeners: {
select: 'fnOnBlur'
}
}


} ],

listeners: {
selectionchange:'fnOnSelectionChange',
cellclick: 'fnOnCellclick',
select: 'fnOnSelect',
viewready: 'onViewReady'
}


} ]
}


]
}

This issue is coming up since an upgrade to 5.1 Previous version being used 5.0 did not have this issue.

Thanks,
Roger

joel.watson
6 Feb 2015, 1:43 PM
Hi Roger--

Can you provide a test case demonstrating the issue? If you can post your code here or (ideally) create a Fiddle, (https://fiddle.sencha.com/) I'll be happy to test this along with you.

Thanks! Joel