IgniteUI / igniteui-blazor

Ignite UI for Blazor component library packs 35+ native Blazor UI Controls with 60+ high-performance Charts designed for any Blazor WASM or Server-side app scenario.
https://www.infragistics.com/products/ignite-ui-blazor
3 stars 3 forks source link

Two-way binding now working for rating #110

Closed wnvko closed 5 months ago

wnvko commented 6 months ago

Description

I have a rating component bound to a variable via @bind.

Steps to reproduce

Use code like this:

<IgbRating @bind-Value="_rating"></IgbRating>
<p>Rating is @_rating</p>
...
@code {
    private double _rating;
}

Result

Changing the value of the rating does not update the bound variable.

Expected result

Rating component should update the related bound variable. Note when using Change event it is working:

<IgbCalendar Value="_date" Change="@(e => _date = (DateTime)e.Detail)"></IgbCalendar>

This one works fine.

gmurray81 commented 5 months ago

@wnvko @zdrawku note: what the generation requires to work this out is this provided on the value property:

/ @tsTwoWayProperty(true, "igcChange", "detail", false) /

this means that when igcChange is fired, we will look at the detail property on the custom event and propagate that outward to act as the new Value at the blazor level. This should also cause the ValueChanged event to be synthesized which is the other required part for the two way bind to work.

gmurray81 commented 5 months ago

I am seeing that attribute in place for rating, so either something messed with the generation, or perhaps there was something wrong with the testing methodology and this is working?

gmurray81 commented 5 months ago

Are there more parameters for how this was being tested? I essentially just tried the above and it seems to work fine to me.

wnvko commented 5 months ago

@gmurray81 This is my code, it is really simple:

<IgbRating @bind-Value="_rating"></IgbRating>
<IgbRating Value="_rating" Change="@(e => _rating = e.Detail)"></IgbRating>
<p>Rating is @_rating</p>
...
@code {
    private double _rating;
}

Note, if I set _rating variable to some value both ratings above initialize correctly with the provided value. Only @bind does not update the bound variable. I am using version 23.2.204.

gmurray81 commented 5 months ago

Again pretty much this exact scenario worked fine for me against main, which should be roughly the same content as 204 as far as this scenario is concerned. Could you send the sample in full so that I can see what is different?

wnvko commented 5 months ago

Here is the repo where I have the projects I am testing the two-way data banding - https://github.com/wnvko/two-way-binding Get it and open the Blazor folder. Inside is the Blazor project which is not working correctly.

wnvko commented 5 months ago

@gmurray81 After restarting my VS and removing the bin/obj folder by hand it is working at my side now. Probably some bad caching :(

Closing this issue now.

Thank you for your time.