forked from syncfusion/ej2-aspnetcore-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLimits.cshtml
257 lines (237 loc) · 10.2 KB
/
Limits.cshtml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
@using Syncfusion.EJ2
@section ControlsSection{
<div class="col-lg-8 control-section">
<div class="content-wrapper">
<div class='sliderwrap'>
<label class="userselect">MinRange Slider With Limits</label>
<ejs-slider id="minrange" value="25" min="0" max="100" step="1" type="MinRange">
<e-slider-ticksdata placement="Before" largeStep="20" smallStep="5" showSmallTicks="true"></e-slider-ticksdata>
<e-slider-tooltipdata isVisible="true" placement="Before" showOn="Focus"></e-slider-tooltipdata>
<e-slider-limitsdata enabled="true" minStart="10" minEnd="40"></e-slider-limitsdata>
</ejs-slider>
</div>
<div class='sliderwrap'>
<label class="userselect">Range Slider With Limits</label>
<ejs-slider id="range" value="ViewBag.rangeValue" min="0" max="100" step="1" type="Range" created="created">
<e-slider-ticksdata placement="Before" largeStep="20" smallStep="5" showSmallTicks="true"></e-slider-ticksdata>
<e-slider-tooltipdata isVisible="true" placement="Before" showOn="Focus"></e-slider-tooltipdata>
<e-slider-limitsdata enabled="true" minStart="10" minEnd="40" maxStart="60" maxEnd="90"></e-slider-limitsdata>
</ejs-slider>
</div>
</div>
</div>
<div class="col-lg-4 property-section property-custom">
<table id="property" title="Properties">
<tbody>
<tr>
<td style="width: 50%">
<div class="userselect">MinStart</div>
</td>
<td style="width: 50%">
<ejs-numerictextbox id="minStart" value="10" min="0" max="100" step="1" change="minStartChange"></ejs-numerictextbox>
</td>
</tr>
<tr>
<td style="width: 50%">
<div class="userselect">MinEnd</div>
</td>
<td style="width: 50%">
<ejs-numerictextbox id="minEnd" value="40" min="0" max="100" step="1" change="minEndChange"></ejs-numerictextbox>
</td>
</tr>
<tr>
<td style="width: 50%">
<div class="userselect">MaxStart</div>
</td>
<td style="width: 50%">
<ejs-numerictextbox id="maxStart" value="60" min="0" max="100" step="1" change="maxStartChange"></ejs-numerictextbox>
</td>
</tr>
<tr>
<td style="width: 50%">
<div class="userselect">MaxEnd</div>
</td>
<td style="width: 50%">
<ejs-numerictextbox id="maxEnd" value="90" min="0" max="100" step="1" change="maxEndChange"></ejs-numerictextbox>
</td>
</tr>
<tr>
<td style="width: 50%">
<div class="userselect">Lock First Handle</div>
</td>
<td style="width: 50%">
<ejs-checkbox id="fixedOne" change="fixOne"></ejs-checkbox>
</td>
</tr>
<tr>
<td style="width: 50%">
<div class="userselect">Lock Second Handle</div>
</td>
<td style="width: 50%">
<ejs-checkbox id="fixedSecond" change="fixSecond"></ejs-checkbox>
</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
var minrangeObj;
var rangeObj;
function created() {
minrangeObj = document.getElementById('minrange').ej2_instances[0];
rangeObj = document.getElementById('range').ej2_instances[0];
if (document.getElementById('right-pane')) {
document.getElementById('right-pane').addEventListener('scroll', onScroll);
}
}
// Eventlisteners to lock first handle of the both sliders
function fixOne(args) {
minrangeObj.limits.startHandleFixed = args.checked;
rangeObj.limits.startHandleFixed = args.checked;
}
// Eventlisteners to lock second handle of the both sliders
function fixSecond(args) {
minrangeObj.limits.endHandleFixed = args.checked;
rangeObj.limits.endHandleFixed = args.checked;
}
// Eventlisteners to change limit values for both sliders
function minStartChange(args) {
minrangeObj.limits.minStart = args.value;
rangeObj.limits.minStart = args.value;
}
function minEndChange(args) {
minrangeObj.limits.minEnd = args.value;
rangeObj.limits.minEnd = args.value;
}
function maxStartChange(args) {
minrangeObj.limits.maxStart = args.value;
rangeObj.limits.maxStart = args.value;
}
function maxEndChange(args) {
minrangeObj.limits.maxEnd = args.value;
rangeObj.limits.maxEnd = args.value;
}
// Handler used to reposition the tooltip on page scroll
function onScroll() {
var slider = [minrangeObj, rangeObj];
slider.forEach((slider) => {
slider.refreshTooltip(slider.tooltipTarget);
});
}
</script>
}
@section Meta{
<meta name="description" content="This example demonstrates how to restricts handle movements of Syncfusion ASP.NET Core slider min, max, start and end of min & max values using limits feature." />
}
@section ActionDescription{
<div id="action-description">
<p>
This sample demonstrates the rendering of Slider component with limits. Drag the thumb over the bar for selecting the
values between assigned limit values. Change the values in the property pane to set different limit values.
</p>
</div>
}
@section Description{
<div id="description">
<p>
The limits are used to limit between certain range. When the limits are assigned, draggable limited area will be in the dark
shadow color of the current theme. The limits APIs are explained below.
</p>
<p>
<table>
<tr>
<td>
<a target="_blank" href="http://ej2.syncfusion.com/documentation/slider/api-limitData.html?lang=es6#minstart">minStart</a>
</td>
<td>
- Used to set minimum limit value for first handle.
</td>
</tr>
<tr>
<td>
<a target="_blank" href="http://ej2.syncfusion.com/documentation/slider/api-limitData.html?lang=es6#minend">minEnd</a>
</td>
<td>
- Used to set maximum limit value for first handle.
</td>
</tr>
<tr>
<td>
<a target="_blank" href="http://ej2.syncfusion.com/documentation/slider/api-limitData.html?lang=es6#maxstart">maxStart</a>
</td>
<td>
- Used to set minimum limit value for second handle.
</td>
</tr>
<tr>
<td>
<a target="_blank" href="http://ej2.syncfusion.com/documentation/slider/api-limitData.html?lang=es6#maxend">maxEnd</a>
</td>
<td>
- Used to set maximum limit value for first handle.
</td>
</tr>
<tr>
<td>
<a target="_blank" href="http://ej2.syncfusion.com/documentation/slider/api-limitData.html?lang=es6#starthandlefixed">startHandleFixed</a>
</td>
<td>
- Used to lock the first handle in the current position.
</td>
</tr>
<tr>
<td>
<a target="_blank" href="http://ej2.syncfusion.com/documentation/slider/api-limitData.html?lang=es6#endhandlefixed">endHandleFixed</a>
</td>
<td>
- Used to lock the second handle in the current position.
</td>
</tr>
</table>
</p>
<p> In this demo, Limits with MinRange and range Slider is demonstrated.</p>
<ul>
<li>MinRange Slider – In this sample, the minimum and maximum limit of the slider is set to 10 and 40 respectively.</li>
<li>
Range Slider – In this sample, the minimum and maximum limit of the first handle is set to 10 and 40 respectively
and the minimum and maximum limit of the second handle is set to 60 and 90 respectively.
</li>
</ul>
<p>
For more information, refer to the
<a target="_blank" href="http://ej2.syncfusion.com/documentation/slider/limits.html?lang=es6">limits</a> section from the documentation.
</p>
</div>
}
<style>
.content-wrapper {
width: 52%;
margin: 0 auto;
min-width: 185px;
}
.sliderwrap {
margin-top: 45px;
}
.e-bigger .content-wrapper {
width: 80%;
}
.sliderwrap label {
padding-bottom: 50px;
font-size: 13px;
font-weight: 500;
margin-top: 15px;
}
.userselect {
-webkit-user-select: none;
/* Safari 3.1+ */
-moz-user-select: none;
/* Firefox 2+ */
-ms-user-select: none;
/* IE 10+ */
user-select: none;
/* Standard syntax */
}
.property-custom td {
padding: 5px;
}
</style>