Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding Side effect #154

Open
Darlingtone opened this issue Jan 4, 2019 · 4 comments
Open

Binding Side effect #154

Darlingtone opened this issue Jan 4, 2019 · 4 comments

Comments

@Darlingtone
Copy link

Darlingtone commented Jan 4, 2019

Am binding the LowerValue and UpperValue to a date range in my ViewModel, when adding a new model binding work just fine, and reflects on the database.

However, when you call up the model for editing, the UpperValue is automatically set to LowerValue (as implemented in ValidateMinRange and ValidateMaxRange) and since it bounded to the model the actual model also changes and if save will reflect on the database.

Cause:
The RangeSlider is initialized with both thumb set to the MinimuValue, if the lower date of the DateRange model is above the MinimuValue and by implication above the UpperValue the ValidateMinRange function will force UpperValue to LowerValue and off course the upper date of the DateRange is also changed via Binding.

Possible Solution:
Initialize RangeSlider with LowerValue set to MinimuValue and UpperValue set to MaximuValue

Not sure what this attributes is for or how to use them:

<!-- the minimum of the range -->
<attr name="absoluteMinValue" format="integer|float" />
<!-- the maximum of the range -->
<attr name="absoluteMaxValue" format="integer|float" />
@charlesroddie
Copy link
Contributor

I'm not sure what this issue is. Can you simplify the description without reference to databases and date ranges? Is this a bug report or a feature request or just a request for help in using the rangeslider for your application?

@Darlingtone
Copy link
Author

Can you simplify the description without reference to databases and date ranges

If you data bind LowerValue and UpperValue to a model with i.e. low = 5 and high = 15, when RangeSlider is initialized it will automatically adjust UpperValue and high to 5

Is this a bug report or a feature request or just a request for help in using the rangeslider for your application

I think it's a bug, expect off course there is a way of changing the default behavior am not aware of then it's a request for help

@charlesroddie
Copy link
Contributor

charlesroddie commented Jan 6, 2019

If I can simplify this further, are you saying:

If you use a RangeSlider, set LowerValue to 5 and set UpperValue to 15, then getting UpperValue gives 5.

This certainly seems strange. But is it valid to do this without setting MinimumValue and MaximumValue? If you don't set these then I can imagine that behaviour is undefined.

Trying to get towards a minimal example here.

@halkar halkar added the bug label Jan 16, 2019
@halkar
Copy link
Owner

halkar commented Jan 19, 2019

If you data bind LowerValue and UpperValue to a model with i.e. low = 5 and high = 15, when RangeSlider is initialized it will automatically adjust UpperValue and high to 5

No, it will not. At least I can't reproduce this behaviour. Can you try to change the sample project to reproduce it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants