|
...
import { DropDownListComponent } from '@syncfusion/ej2-react-dropdowns';
...
class App extends React.Component<{}, {}>{
public gridInstance: any;
public toolbarOptions: ToolbarItems[] = [{ template: this.template}];
public template(props) {
return (<DropDownListComponent id="dropdown" dataSource={data} placeholder="Select" fields= { { text: 'OrderID', value: 'OrderID' } }/>);
}
render() {
return <GridComponent dataSource={data} toolbar={this.toolbarOptions} ref={g => this.gridInstance = g} height={240}>
<ColumnsDirective>
...
</ColumnsDirective>
<Inject services={[ Toolbar ]} />
</GridComponent>
}
};
ReactDOM.render(<App />, document.getElementById('grid')); |
|
export class Default extends SampleBase {
constructor() {
super(...arguments);
this.toolbarOptions = [ { text: 'Add', prefixIcon: 'e-add', id: 'add' },
{ template: this.toolbarDropdownMenuTemplate }
];
}
toolbarDropdownMenuTemplate(props) {
const toolbarDropdownMenuItems = [
...
return ( //render the DropDownButtonComponent on grid toolbar
<DropDownButtonComponent
items={toolbarDropdownMenuItems}
iconCss='e-icons e-message'
> Message
</DropDownButtonComponent>);
}
render() {
return <GridComponent dataSource={orderDetails} toolbar={this.toolbarOptions} ref={g => this.gridInstance = g} height={240}>
<ColumnsDirective>
<ColumnDirective field='OrderID' width='100' textAlign="Right"></ColumnDirective>
...
<Inject services={[ Toolbar ]} />
</GridComponent>
}
}
render(<Default />, document.getElementById('sample')); |
|
|