mercredi 25 juin 2014

No way to refresh Grid Summary after grid data is changed

Hi,

I'm using a grid with "groupingsummary" feature in Ext JS 5. In this grid, I'm adding few records after which I reload my grid store. But after store is successfully reloaded, the summary row of grid is not reloaded for those previous/old records, while summary row looks fine for new records.

Here is part of my code -

Store for my Grid....



Code:



Ext.define('YagnaPS.store.bom.Products',{
....................
groupField: 'rootPart',
proxy: {
type: 'ajax',
url: '/api/pricingbom/get',
extraParams:{
bomId:''
},
reader:{
type: 'json',
rootProperty:"pricingBomList"
}
}
..................
});

Here is grid -

Code:



Ext.define('YagnaPS.view.bom.BoMGrid',{
extend: 'Ext.grid.Panel',
................................
features : [
{
ftype : 'groupingsummary',
groupHeaderTpl:'{name}',
startCollapsed: true,
hideGroupedHeader:true
}
],
columns:[
{
text: 'Product',
dataIndex: 'pricingPartName',
align:'left',
renderer: function(value, metaData, record, rowIndex, colIndex) {
...............................
},
summaryType : function(records){
if(records[0].get('partNumber') == null)
return '-';
var rootPartName = records[0].get('rootPart');
return Ext.String.format(rootPartName);
},
summaryRenderer: function(value, summaryData, dataIndex) {
return Ext.String.format('{0}',value);
},
flex:4
},

Here are few snapshots before and after grid store is loaded with new records...

1. Before adding new record

BeforeAddition.jpg


2. After adding new record (Highlighted record is added)


After Addition.jpg


Till Ext JS 4.x , there was a method to refresh Grid summary as below :



Code:



grid.getView().getFeature(0).refresh();

But in Ext JS 5.0 , I cant find any method to refresh the summary.

Please help. If any work around is present, please let me know.


Thanks.





Aucun commentaire:

Enregistrer un commentaire