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 pathdefault.tsx
More file actions
72 lines (68 loc) · 3.29 KB
/
default.tsx
File metadata and controls
72 lines (68 loc) · 3.29 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
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { MultiSelectComponent } from '@syncfusion/ej2-react-dropdowns';
import { SampleBase } from '../common/sample-base';
import './default.css';
export class Default extends SampleBase<{}, {}> {
// define the JSON of data
private sportsData: { [key: string]: Object }[] = [
{ Id: 'Game1', Sports: 'American Football' },
{ Id: 'Game2', Sports: 'Badminton' },
{ Id: 'Game3', Sports: 'Basketball' },
{ Id: 'Game4', Sports: 'Cricket' },
{ Id: 'Game5', Sports: 'Football' },
{ Id: 'Game6', Sports: 'Golf' },
{ Id: 'Game7', Sports: 'Hockey' },
{ Id: 'Game8', Sports: 'Rugby' },
{ Id: 'Game9', Sports: 'Snooker' },
{ Id: 'Game10', Sports: 'Tennis' }
];
// maps the appropriate column to fields property
private fields: object = { text: 'Sports', value: 'Id' };
// set the value to select an item based on mapped value at initial rendering
private value: string = 'Game3';
render() {
return (
<div className = 'control-pane'>
<div id="multisection" className='control-section'>
<div id="multidefault">
<div className="control-styles">
<h4>Default Mode</h4>
<div>
<MultiSelectComponent id="defaultelement" dataSource={this.sportsData} mode="Default" fields={this.fields} placeholder="Favorite Sports" />
</div>
</div>
<div className="control-styles">
<h4>Box Mode</h4>
<div>
<MultiSelectComponent id="boxelement" dataSource={this.sportsData} mode="Box" fields={this.fields} placeholder="Favorite Sports" />
</div>
</div>
<div className="control-styles">
<h4> Delimiter Mode</h4>
<div>
<MultiSelectComponent id="delimiterelement" dataSource={this.sportsData} mode="Delimiter" fields={this.fields} placeholder="Favorite Sports" />
</div>
</div>
</div>
</div>
<div id="action-description">
<p>This sample demonstrates the default functionalities of the MultiSelect. Type a character in the MultiSelect element or click on this element to choose one or more items from the suggestion list.</p>
</div>
<div id="description">
<p>The <code>MultiSelect</code> component contains a list of predefined values, from that the user can choose a multiple
values. </p>
<p>In this sample, the selected items are shown with three different UI modes in three different MultiSelect elements. That three UI modes are listed here below,</p>
<ul>
<li><b>Default</b> - on focus-in, the component will act in <code>box mode</code> and on blur, the component will act in <code>delimiter mode</code>.</li>
<li><b>Box</b> - selected items will be visualized in chip.</li>
<li><b>Delimiter</b> - selected items will be visualized in text content.</li>
</ul>
<p> More information on the MultiSelect instantiation can be found in the
<a href="http://ej2.syncfusion.com/react/documentation/multi-select/getting-started.html" target="_blank"> documentation section</a>.
</p>
</div>
</div>
);
}
}