PDA

View Full Version : groupingSummary can be done in store using XmlReader ???



poojagarg89
8 Aug 2012, 10:01 PM
I want to use summary plugin through which I can do total of all values of one particular column and can show it in the grid here is my code: ExtJs 3.4 version
var cash_ledger_ds=new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'CashLedgerDetails', // cash_ledger servlet
method:'POST'}),
reader: new Ext.data.XmlReader({
record: 'items',
totalProperty:'total'
},
['date_of_transaction','voucher_number','partyorexpenditure','bill_number',
{name:'debit_amount',type: 'int'},
'credit_amount',
// debit_amount is to be totaled
'narration','created_on','created_by','sessionInfo','debitsum','creditsum','diff']), baseParams:{load_type:'showbylimit'},
remoteSort: true
});
var summary = new Ext.ux.grid.GroupSummary();
var cash_ledger_grid_sm = new Ext.grid.CheckboxSelectionModel();
var cash_ledger_grid = new Ext.grid.GridPanel({
id: 'cash_ledger_grid', region:'center', store:cash_ledger_ds , loadMask: true,
//anchor:'1',
plugins:summary,
// features: [{
// ftype: 'groupingsummary'//,
// //showSummaryRow:true
// }],
bbar:cash_ledger_pagingBar,
layout:'fit',
columnLines: true,
autoScroll: true,
// view: new Ext.grid.GroupingView({
// forceFit: true,
// showGroupName: false,
// enableNoGroups: false,
// enableGroupingMenu: false,
// hideGroupedColumn: true
// }),
colModel: new Ext.grid.ColumnModel({
columns: [cash_ledger_grid_sm,
{id: 'date_of_transaction1' , header: "Date of Transaction", dataIndex: 'date_of_transaction',sortable:true,
summaryType: 'count',
summaryRenderer: function(v, params, data){
//var sum = 0;
return "" ;
}},
{id: 'voucher_number1' ,
header: "Voucher Number",
dataIndex: 'voucher_number',
sortable:true
},
{id: 'party_name1' ,
header: "Party Name/Head of Account",
dataIndex: 'partyorexpenditure',
sortable:true
},
{id: 'bill' , header: "Bill Number",
dataIndex: 'bill_number',
sortable:true
}, {id: 'amount1' ,
header: "Debit",
dataIndex: 'debit_amount',
sortable:true,
summaryType: 'sum',
// summaryRenderer: function(v, params, data){
// var sum = 0;
// return sum=sum+v ;
// },
renderer : function(v){
var sum = 0;
return sum=sum+v ;
}
},
{id: 'amount2' , header: "Credit", dataIndex: 'credit_amount',sortable:true}, {id: 'narration1' , header: "Narration", dataIndex: 'narration',sortable:true}] }),
// viewConfig: {
// forceFit: true
// },
animCollapse: false, stripeRows:true, autoScroll:true });

Can Anyone help me ? I am refering this example http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/totals.html Thanks in advance....!!! :D

scottmartin
9 Aug 2012, 10:49 AM
What problems are you having?

Scott.

poojagarg89
9 Aug 2012, 8:36 PM
Thanks Scott for reply
I got that :) but now I have other issue that is groupingsummary is not fulfilling my need

I'll create a new post for that as its not related to groupingSummary

Regards,
Pooja