Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149695 | Dec 5,2019 04:36 PM UTC | Feb 11,2020 12:56 PM UTC | React - EJ 2 | 5 |
![]() |
Tags: Grid |
import { render } from 'react-dom';
import './index.css';
import * as React from 'react';
import { DropDownListComponent } from '@syncfusion/ej2-react-dropdowns';
import { GridComponent, ColumnsDirective, ColumnDirective, Page, Filter, Inject } from '@syncfusion/ej2-react-grids';
import { orderDataSource } from './data';
import { SampleBase } from './sample-base';
export class FilterMenu extends SampleBase {
constructor() {
super(...arguments);
this.filterSettings = { type: 'Excel' };
this.fields = { text: 'text', value: 'value' };
}
valueAccess(field, data, column){
return data[field] + 678 ; // here you can customize your data
}
filterValue = {
type: 'CheckBox',
itemTemplate: (e)=>{
return <span>{e.data[e.column.field] +'678'}</span> // here you can return your customized data
}
}
render() {
return (<div className='control-pane'>
<div className='control-section row'>
<GridComponent dataSource={orderDataSource} allowPaging={true} ref={grid => this.gridInstance = grid} pageSettings={{ pageSize: 10, pageCount: 5 }} allowFiltering={true} filterSettings={this.filterSettings}>
<ColumnsDirective>
<ColumnDirective field='OrderID' headerText='Order ID' width='120' textAlign='Right'></ColumnDirective>
<ColumnDirective field='ShipCountry' headerText='Ship Country' width='150' filter={this.filterValue} valueAccessor={this.valueAccess}></ColumnDirective>
<ColumnDirective field='CustomerName' headerText='Customer Name' width='150'></ColumnDirective>
</ColumnsDirective>
<Inject services={[Filter, Page]}/>
</GridComponent>
</div>
</div>);
}
} |
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.