Completed
Last Updated: 30 Mar 2021 11:57 by Philip
Philip
Created on: 27 Mar 2021 04:54
Category: UI for Blazor
Type: Feature Request
0
Oninput event for controls (DateRangePicker eg)

Hello

 

I noticed the DateRangePicker "OnChange" fires "on blur".

Confirmed by the docs;

https://docs.telerik.com/blazor-ui/components/daterangepicker/events#onchange

 

Is it possible to expose OnInput even for a "react style" onchange event?

https://linguinecode.com/post/onblur-vs-onchange-react-text-inputs

 

I think the StartValueChanged and EndValueChanged events have the same behaviour so unbinding might not be a solution..?

 

Attached is a use case where it is confusing because the events are not in sync... You'll see the grid data changes (data bound), but OnChange after you click out.

Attached Files:
2 comments
Philip
Posted on: 30 Mar 2021 11:57

Ah yes sorry my mistake - I thought they were firing on lose focus also.

 

Thankyou Marin

ADMIN
Marin Bratanov
Posted on: 30 Mar 2021 06:26

Hello Philip,

To quote the article: "React onChange gets triggered on every keystroke on the keyboard." - this is when our ValueChanged event fires for all our inputs. We deliberately chose that to provide real-time updates, validation and experience, not just through an event, but also for two-way binding. For the range picker, that's two events: StartValueChanged and EndValueChanged.

Since these two events are also used for two-way binding by default, when you use them yourself to respond to user actions that quickly, you also have to do the upwards binding yourself, in Blazor you can't have both. You can read more about this here: Value Binding vs Data Binding.

Depending on what you are after, you may find the following two KB articles useful: Capture input keyboard events and OnChange fires twice.

As for what I see in the video - the app behavior will be extremely dependent on the code that is written around the components. I imagine that you would get that behavior if the grid data is bound to a .Where() clause that uses the dates from two-way binding, so that re-renders every time ValueChanged fires, but the chart is not (to change its data you need a specific event so you can update its data collection). So, a solution for that would be to either always use the ValueChanged events to update both components, or to use OnChange for both - not just the chart but also the grid.

Regards,
Marin Bratanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.