Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150174 | Dec 23,2019 06:46 PM UTC | Jan 3,2020 09:34 AM UTC | React - EJ 2 | 3 |
![]() |
Tags: Grid |
[index.js]
dataBound(args){
this.gridInstance.getHeaderContent().append(this.gridInstance.getFooterContent());
} |
[index.js]
export class AggregateDefault extends SampleBase {
constructor() {
super(...arguments);
this.pageSettings = { pageCount: 5 };
}
footerSum(props) {
return (<span>Sum: {props.Custom}</span>);
}
. . . .
customAggregateFn(args){
let freight_total = 0; //Perform your custom aggregation here
for(let i=0; i<args.result.length;i++) {
freight_total += args.result[i].Freight;
}
return freight_total;
}
render() {
return (<div className='control-pane'>
<div className='control-section'>
<GridComponent ref={g=>this.gridInstance=g} dataSource={data} allowPaging={true} pageSettings={this.pageSettings} dataBound={this.dataBound.bind(this)}>
<ColumnsDirective>
. . . .
</ColumnsDirective>
<AggregatesDirective>
<AggregateDirective>
<AggregateColumnsDirective>
<AggregateColumnDirective field='Freight' type='Custom' format='C2' customAggregate={this.customAggregateFn.bind(this)} footerTemplate={this.footerSum}> </AggregateColumnDirective>
</AggregateColumnsDirective>
</AggregateDirective>
</AggregatesDirective>
<Inject services={[Page, Aggregate]}/>
</GridComponent>
|
customAggregateFn(args){
let freight_total = 0; //Perform your custom aggregation here
for(let i=0; i< this.gridInstance.dataSource.length; i++) { // complete data list
freight_total += this.gridInstance.dataSource[i].Freight;
}
return freight_total;
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.