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 pathsidebar-list.tsx
More file actions
79 lines (75 loc) · 3.35 KB
/
sidebar-list.tsx
File metadata and controls
79 lines (75 loc) · 3.35 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
79
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { SidebarComponent } from '@syncfusion/ej2-react-navigations';
import { ListViewComponent, SelectEventArgs } from '@syncfusion/ej2-react-lists';
import { enableRipple } from '@syncfusion/ej2-base';
import { SampleBase } from '../common/sample-base';
import './sidebar-list.css';
export class SidebarWithList extends SampleBase<{}, {}> {
public sidebarobj: SidebarComponent;
public dataList: { [key: string]: Object }[] = [
{ text: 'Home' },
{ text: 'About' },
{ text: 'Careers' },
{ text: 'FAQs' },
{ text: 'Blog' },
{ text: 'Uses' },
{ text: 'Contact' }
];
public fields: object = { tooltip: 'text' };
render() {
return (
<div className="control-section">
<div className="col-lg-12 col-sm-12 col-md-12 center">
Click the button to view the sample
</div>
<div className="col-lg-12 col-sm-12 col-md-12 center">
<a className="e-btn" id="newTab" target="_blank" onClick={this.newTabClick.bind(this)}>Open in new Tab</a>
</div>
<div id="wrapper">
<title>Essential JS 2 for React - Sidebar > Sidebar with ListView </title>
<div className="col-lg-12 col-sm-12 col-md-12">
<div id="head">
<div className="text">Menu</div>
<span id="hamburger" className="e-icons menu" onClick={this.openClick.bind(this)} ></span>
<div className="header">Header Content</div>
</div>
<SidebarComponent id="sidebar-menu" ref={Sidebar => this.sidebarobj = Sidebar} type="Over" width="250px">
<div id="close" className="e-icons" onClick={this.closeClick.bind(this)}></div>
<div className="content-area">
<ListViewComponent id="menuList" dataSource={this.dataList} fields={this.fields} select={this.onSelect.bind(this)}>
</ListViewComponent>
</div>
</SidebarComponent>
<div>
<div className="main content textArea">Application content</div>
</div>
</div>
</div>
<div id="action-description">
<p> Click the button to view the Sidebar sample in new tab.</p>
</div>
<div id="description">
<p>I In this sample, the ListView component is placed inside the Sidebar for navigation.</p>
</div>
</div>
);
}
//open newTab
newTabClick(): void {
document.getElementById('newTab').setAttribute('href', location.href.split('#')[0] + 'sidebar/sidebar-list/index.html');
}
//close the sidebar when list item selected
onSelect(args:any): void {
this.sidebarobj.hide();
document.querySelector('.textArea').textContent = args.text + ' Page Content';
}
//open the sidebar
openClick(): void {
this.sidebarobj.show();
}
//close the sidebar
closeClick(): void {
this.sidebarobj.hide();
}
}