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 pathgrid-lines.tsx
More file actions
74 lines (67 loc) · 4.15 KB
/
grid-lines.tsx
File metadata and controls
74 lines (67 loc) · 4.15 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
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { ToolbarComponent, ItemsDirective, ItemDirective } from '@syncfusion/ej2-react-navigations';
import { GridComponent, ColumnsDirective, ColumnDirective, GridLine, Page, Inject } from '@syncfusion/ej2-react-grids';
import { employeeData } from './data';
import { addClass, removeClass } from '@syncfusion/ej2-base';
import { SampleBase } from '../common/sample-base';
export class GridLines extends SampleBase<{}, {}> {
public lines: String = "Default";
private gridInstance: GridComponent;
public click(e: MouseEvent): void {
let element: HTMLElement = e.target as HTMLElement;
if (!element.classList.contains('e-tbar-btn-text') && !element.classList.contains('e-tbar-btn')) {
return;
}
element = (element.tagName === 'BUTTON' ? element.firstElementChild : element) as HTMLElement;
removeClass([].slice.apply(document.getElementsByClassName('e-ghidden')), 'e-ghidden');
addClass([element.parentElement.parentElement], 'e-ghidden');
this.lines = element.innerHTML;
this.gridInstance.gridLines = this.lines as GridLine;
this.gridInstance.refresh();
}
render() {
return (
<div className='control-pane'>
<div className='control-section'>
<div className='e-statustext'>Select Grid Line</div>
<ToolbarComponent id="toolbar" onClick={this.click.bind(this)} >
<ItemsDirective>
<ItemDirective text='Default' cssClass="e-ghidden" />
<ItemDirective text="None" />
<ItemDirective text="Both" />
<ItemDirective text="Horizontal" />
<ItemDirective text="Vertical" />
</ItemsDirective>
</ToolbarComponent>
<br />
<GridComponent dataSource={employeeData} ref={grid => this.gridInstance = grid} gridLines='Default'>
<ColumnsDirective>
<ColumnDirective field='EmployeeID' headerText='Employee ID' width='125' textAlign='Right' />
<ColumnDirective field='FirstName' headerText='FirstName' width='125' />
<ColumnDirective field='Title' headerText='Title' width='180' />
<ColumnDirective field='HireDate' headerText='Hire Date' width='135' format={{ skeleton: 'yMd', type: 'date' }} textAlign='Right' />
</ColumnsDirective>
</GridComponent>
</div>
<div id="action-description">
<p>This sample demonstrates visibility of the grid lines that separates the rows and columns. In this sample, you can change
the gridline from the toolbar.</p>
</div>
<div id='description'>
<p> The <code><a target='_blank' className='code'
href='http://ej2.syncfusion.com/react/documentation/grid/api-grid.html#gridlines-string'>
gridLines</a></code> property is used to control the line visibility that separates the rows and columns. The Grid allow us to display the following grid lines,</p>
<ul><li><code>Default</code> - Shows the Horizontal line.</li>
<li><code>None</code> - Shows no line.</li>
<li><code>Both </code>- Shows both Horizontal and Vertical lines.</li>
<li><code>Horizontal</code> - Shows the Horizontal line.</li>
<li><code>Vertical</code> - Shows the Vertical line.</li></ul>
<p>In this demo, you can modify the display of gridlines by selecting values in the toolbar.</p>
<p>More information on the gridLines configuration can be found in this <a target='_blank' href='http://ej2.syncfusion.com/react/documentation/grid/api-grid.html#gridlines-string'> documentation section</a>.
</p>
</div>
</div>
)
}
}