You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/rangeslider/events.md
+114-6Lines changed: 114 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,31 +12,35 @@ position: 20
12
12
13
13
This article showcases the available events in the Telerik RangeSlider component:
14
14
15
-
16
15
*[StartValueChanged and EndValueChanged](#startvaluechanged-and-endvaluechanged)
16
+
*[OnChange](#onchange)
17
17
18
18
## StartValueChanged and EndValueChanged
19
19
20
20
`StartValueChanged` fires when the user moves the lower range of the slider, and `EndValueChanged` fires when the user changes the higher range of the slider.
21
21
22
-
The `ValueChanged` events fire every time the corresponding `Value` parameter changes. This happens after the user stops dragging the handle or when they click on the track.
22
+
The `ValueChanged` events fire every time the corresponding `Value` parameter changes. This happens while the user is dragging the handle or when they click on the track.
23
23
24
-
The events do not fire continuously while the user is dragging the handle because that would re-render the component and cause both poor performance, and the user to stop dragging because the element they are dragging will disappear.
24
+
>tip As of version 2.28.0 of Telerik UI for Blazor, the `ValueChanged` events fire continuously while the user is dragging the handle to ensure updating the value accordingly and deliver live UX. Thus, the component will re-render multiple times during the dragging process. If you want to avoid that, you can handle the [`OnChange`](#onchange) event instead.
25
25
26
-
>caption Handle StartValueChanged and EndValueChanged to filter products
26
+
>caption Handle the StartValueChanged and EndValueChanged to filter products
27
27
28
28
````CSHTML
29
29
@* This example showcases one-way data binding by using Value and ValueChanged
30
30
It also shows how you could filter data based on the user selection in the slider *@
The `OnChange` event represents a user action - confirmation of the current value. It fires when the user stops dragging the handle or when they click on the track.
130
+
131
+
The handler receives an object of type `RangeSliderChangeEventArgs` which exposes the following fields:
132
+
133
+
*`StartValue` - the new lower value of the slider that marks the range start.
134
+
*`EndValue` - the new higher value of the slider that marks the range end.
135
+
136
+
If you use two-way binding, this will effectively fire the [`StartValueChanged and EndValueChanged`](#startvaluechanged-and-endvaluechanged) events while the user is dragging the handle. This will result in continuous component re-rendering. If you want to avoid that, use one-way binding and update the value for the view-model in the `OnChange` event handler.
137
+
138
+
>tip The `OnChange` event is a custom event and does not interfere with bindings, so you can use it together with models and forms.
139
+
140
+
>caption Handle the OnChange event to filter products
141
+
142
+
````CSHTML
143
+
@* This example showcases one-way data binding and handling the OnChange event to update the view-model.
144
+
If you want to update the value while the user drags the handle, you can additionally use two-way binding or handle the ValueChanged event.
145
+
It also shows how you could filter data based on the user selection in the slider *@
Copy file name to clipboardExpand all lines: components/slider/events.md
+51-5Lines changed: 51 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,22 +13,27 @@ position: 20
13
13
This article showcases the available events in the Telerik Slider component:
14
14
15
15
*[ValueChanged](#valuechanged)
16
+
*[OnChange](#onchange)
16
17
17
18
## ValueChanged
18
19
19
-
The `ValueChanged` event fires every time the `Value` parameter changes. This happens when the user clicks or taps the increase/decrease buttons; and after the user stops dragging the handle; and when the user clicks on the track.
20
+
The `ValueChanged` event fires every time the `Value` parameter changes. This happens when the user:
21
+
* clicks on the increase/decrease buttons;
22
+
* clicks on the track;
23
+
* while dragging the handle;
20
24
21
-
The event does not fire continuously while the user is dragging the handle because that would re-render the component and cause both poor performance, and the user to stop dragging because the element they are dragging will disappear.
25
+
>tip As of version 2.28.0 of Telerik UI for Blazor, the `ValueChanged` event fires continuously while the user is dragging the handle to ensure updating the value accordingly and deliver live UX. Thus, the component will re-render multiple times during the dragging process. If you want to avoid that, you can handle the [`OnChange`](#onchange) event instead.
22
26
23
-
>caption Handle ValueChanged
27
+
>caption Handle the ValueChanged
24
28
25
29
````CSHTML
26
30
@*This example showcases one-way data binding by using Value and ValueChanged*@
The `OnChange` event represents a user action - confirmation of the current value. It fires when the user:
60
+
* clicks on the increase/decrease buttons;
61
+
* clicks on the track;
62
+
* after the user stops dragging the handle;
63
+
64
+
If you use two-way binding, the [`ValueChanged`](#valuechanged) event will fire continuously while the user is dragging the handle. This will result in continuous component re-rendering. If you want to avoid that, use one-way binding and update the value for the view-model in the `OnChange` event handler.
65
+
66
+
67
+
>tip The `OnChange` event is a custom event and does not interfere with bindings, so you can use it together with models and forms.
68
+
69
+
>caption Handle the OnChange event
70
+
71
+
````CSHTML
72
+
@* This example showcases one-way data binding and handling the OnChange event to update the view-model.
73
+
If you want to update the value while the user drags the handle, you can additionally use two-way binding or handle the ValueChanged event.*@
0 commit comments