Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
151019 | Jan 28,2020 11:43 AM UTC | Jan 29,2020 09:15 AM UTC | React - EJ 2 | 1 |
![]() |
Tags: Grid |
export class Grouping extends SampleBase {
constructor() {
super(...arguments);
this.groupOptions = { showGroupedColumn: false, columns: ['Country'],
captionTemplate:'#groupTemplate'
};
}
dataBound() {
if (refresh) {
this.gridInstance.groupColumn('Country');
refresh = false;
}
}
load() {
refresh = this.refreshing;
}
render() {
return (<div className='control-pane'>
<div className='control-section'>
<GridComponent dataSource={inventoryData} allowPaging={true} ref={grid => this.gridInstance = grid} pageSettings={{ pageCount: 5 }} allowGrouping={true} groupSettings={this.groupOptions} allowSorting={true} height="320" dataBound={this.dataBound.bind(this)} load={this.load}>
<ColumnsDirective>
. . . . . . .
. . . . . . .
</ColumnsDirective>
<Inject services={[Page, Group, Sort]}/>
</GridComponent>
</div>
</div>);
}
} |
Index.html
<script id="groupTemplate" type="text/x-template">
${groupTemplate(data)}
</script>
<script type="text/javascript">
function groupTemplate(args) {
if (args.field == "Country") { //we have customize the caption only for country field
return "TOTAL of group:" + args.count + " item";
}
}
</script> |
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.