This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcolumn-menu.tsx
More file actions
78 lines (73 loc) · 4.58 KB
/
column-menu.tsx
File metadata and controls
78 lines (73 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { GridComponent, ColumnsDirective, ColumnDirective, Resize, Group, Sort, ColumnMenu, Filter, Page, Inject } from '@syncfusion/ej2-react-grids';
import { GroupSettingsModel, FilterSettingsModel } from '@syncfusion/ej2-react-grids';
import { orderDetails } from './data';
import { SampleBase } from '../common/sample-base';
import './grid-context-menu.css';
export class ColumnMenuSample extends SampleBase<{}, {}> {
public groupOptions: GroupSettingsModel = { showGroupedColumn: true };
public filterSettings: FilterSettingsModel = { type: "CheckBox" };
render() {
return (
<div className='control-pane'>
<div className='control-section'>
<GridComponent id='gridcomp' dataSource={orderDetails} allowPaging={true} allowGrouping={true} allowSorting={true} allowFiltering={true} showColumnMenu={true} groupSettings={this.groupOptions} filterSettings={this.filterSettings} >
<ColumnsDirective>
<ColumnDirective field='OrderID' headerText='Order ID' width='200' textAlign='Right' showInColumnChooser={false}></ColumnDirective>
<ColumnDirective field='CustomerName' headerText='Customer Name'></ColumnDirective>
<ColumnDirective field='ShippedDate' headerText='Shipped Date' format='yMd' textAlign='Right' />
<ColumnDirective field='Freight' headerText='Freight' width='150' format='C2' textAlign='Right' />
<ColumnDirective field='ShipName' headerText='Ship Name' visible={false} width='200'></ColumnDirective>
<ColumnDirective field='ShipCountry' headerText='Ship Country' width='200'></ColumnDirective>
</ColumnsDirective>
<Inject services={[Resize, Group, Sort, ColumnMenu, Filter, Page]} />
</GridComponent>
</div>
<div id="action-description">
<p>This sample demonstrates the column menu feature. Click the multiple icon of each column to
show the column menu.
</p>
</div>
<div id="description">
<p>
Grid has option to show column menu when click on multiple icon of each column. The column menu has integrated options to
interact the features like sorting, grouping, filtering, column chooser and autoFit. This features can be enabled
by defining the
<code><a target="_blank" className="code"
href="http://ej2.syncfusion.com/react/documentation/grid/api-gridComponent.html#showcolumnmenu-boolean">showColumnMenu
</a></code> as true. The default items are
</p>
<ul>
<li>
<code>sortAscending</code> - Sort the current column in ascending order.</li>
<li>
<code>sortDescending</code> - Sort the current column in descending order.</li>
<li>
<code>group</code> - Group the current column.</li>
<li>
<code>ungroup</code> - Ungroup the current column.</li>
<li>
<code>autoFit</code> - Auto fit current column.</li>
<li>
<code>autoFitAll</code> - Auto fit all columns.</li>
<li>
<code>columnChooser</code> - Choose the column visibility.</li>
<li>
<code>Filter</code> - Show the filter option as given in
<code>filterSetting-> type</code>.</li>
</ul>
<br />
<p>
In this demo, Column Menu feature has enabled by defining
<code> showColumnMenu </code> as true with sorting, grouping, filtering, column chooser and autoFit options.
</p>
<p style={{ fontWeight: 500 }}>Injecting Module:</p>
<p>
Grid component features are segregated into individual feature-wise modules. To use Column menu feature, we need to inject <code>ColumnMenu</code> modeule into the <code>services</code>
</p>
</div>
</div>
)
}
}