[index.js]
import { render } from 'react-dom';
import './index.css';
import * as React from 'react';
import { GridComponent, Grid, ColumnsDirective, ColumnDirective, Toolbar, ColumnChooser, Inject, Page } from '@syncfusion/ej2-react-grids';
import { data } from './data';
import { SampleBase } from './sample-base';
export class ColChooser extends SampleBase {
dataBound(){
this.selectedRowIndices = [1,2,4];
this.gridInstance.selectRows(this.selectedRowIndices);
}
constructor() {
super(...arguments);
this.settings = { mode: 'Row', type: 'Multiple'};
}
render() {
return (<div className='control-pane'>
<div className='control-section'>
<GridComponent dataSource={data} ref={grid =>
this.gridInstance = grid} dataBound={this.dataBound.bind(this)} allowPaging={true} selectionSettings={this.settings} >
<ColumnsDirective>
-----
</ColumnsDirective>
<Inject services={[Page]} />
</GridComponent>
</div>
</div>);
}
}
|