Hi,
please run the following code, and then scroll the grid to the last row.
when you click the tbar button 'click' to change the value of a field (not the groupField),
the grid will scrolls to the first line.
In my project ,i use the grouped grid to monitor the system status every 2 seconds.
so , the last row of it can hardly be shown.
It works fine on Ext4.1 Beta. when i update to 4.1.1 today, I found it works abnormally.
thanks
Code:
Ext.require(['Ext.data.*', 'Ext.grid.*']);
Ext.onReady(function() {
// wrapped in closure to prevent global vars.
Ext.define('Restaurant', {
extend: 'Ext.data.Model',
fields: ['name', 'cuisine']
});
var data = [];
for(i=0;i<50;i++)
{
data.push({
name: 'Cheesecake Factory',
cuisine: 'Group ' + (i%10)
});
}
var Restaurants = Ext.create('Ext.data.Store', {
storeId: 'restaraunts',
model: 'Restaurant',
groupField: 'cuisine',
sorters: ['cuisine','name'],
data: data
});
var groupingFeature = Ext.create('Ext.grid.feature.Grouping',{
groupHeaderTpl: 'Cuisine: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})',
hideGroupedHeader: true
});
var grid = Ext.create('Ext.grid.Panel', {
renderTo: Ext.getBody(),
collapsible: true,
iconCls: 'icon-grid',
frame: true,
store: Restaurants,
width: 600,
height: 400,
title: 'Restaurants',
resizable: true,
features: [groupingFeature],
columns: [{
text: 'Name',
flex: 1,
dataIndex: 'name'
},{
text: 'Cuisine',
flex: 1,
dataIndex: 'cuisine'
}],
fbar : ['->', {
text:'Clear Grouping',
iconCls: 'icon-clear-group',
handler : function(){
groupingFeature.disable();
}
}],
tbar:[{
text:'click',
handler: function(){
var record = Restaurants.getAt(Restaurants.getCount()-1);
record.set('name','test');
record.commit();
}
}]
});
});