PDA

View Full Version : Why in the grouping grid new records added to the end?



eugenn
16 Jan 2014, 5:20 AM
I have a grid with grouping by some columns. So when add a new record to the grid then it added to the end. If refresh the grid then record will be displayed in the right position. See attached screenshot. Is it bug or feature?
ExtJS version 4.1.2

scottmartin
16 Jan 2014, 5:48 AM
We may need to see an example of this. You can run this example in our fiddle and it works as expected:

https://fiddle.sencha.com/#home



// insert code in fiddle
Ext.onReady(function(){

var store = Ext.create('Ext.data.Store', {
fields : ['name', 'email', 'change', 'type'],
data : {'items' : [
{ 'name' : 'Lisa', 'email' : 'lisa@simpsons.com', 'change' : 100, 'type' : 'child' },
{ 'name' : 'Bart', 'email' : 'bart@simpsons.com', 'change' : -20, 'type' : 'child' },
{ 'name' : 'Homer', 'email' : 'home@simpsons.com', 'change' : 23 , 'type' : 'parent' },
{ 'name' : 'Marge', 'email' : 'marge@simpsons.com', 'change' : -11, 'type' : 'parent' }
]},
groupField: 'type',
proxy : {
type : 'memory',
reader : {
type : 'json',
root : 'items'
}
}

});

var grid = Ext.create('Ext.grid.Panel', {
title : 'Simpsons',
store : store,
columns : [
{ header : 'Name', dataIndex : 'name' },
{ header : 'Email', dataIndex : 'email', flex : 1 },
{ header : 'Change', dataIndex : 'change' }
],
features: [{
ftype: 'grouping'
}],
height : 300,
width : 400,
renderTo : Ext.getBody()
});

// add to top group
store.add({'name' : 'Sencha', 'email' : 'support@sencha.com', 'change' : 1000, 'type' : 'child'});

});

eugenn
17 Jan 2014, 1:08 AM
Thank you for the help looks like something wrong with my code.