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

The style of the spin button in igNumericEditor is not correct when it switches from disabled. #2165

Closed
IG-Mori opened this issue Nov 30, 2021 · 3 comments · Fixed by #2166
Closed

Comments

@IG-Mori
Copy link

IG-Mori commented Nov 30, 2021

Description

To prevent setting values that exceed the maximum and minimum values, the spin button is made inactive in the style, but if you switch between disable and enable for igNumericEditor, the spin button inactivity control will no longer work.

  • ignite-ui version: 21.1
  • browser: Chrome, Edge

Steps to reproduce

  1. Prepare an igNumericEditor with minValue is zero.(The downward spin button is disabled.)
  2. If you enter zero, the downward spin button is disabled.
  3. Set the option disabled to True.
  4. Set the option disabled to False.
  5. The downward spin button will be enabled.

image
image
image

Result

The downward spin button will be enabled.
image

Expected result

The downward spin button should remain disabled.

Attachments

sample.zip

@IG-Mori IG-Mori added the bug label Nov 30, 2021
@IG-Mori
Copy link
Author

IG-Mori commented Nov 30, 2021

Could you tell me a workaround if there is any?

Lipata added a commit that referenced this issue Nov 30, 2021
fix(numeric-editor): fix numeric editor spin button style when setting editable mode #2165
Lipata added a commit that referenced this issue Nov 30, 2021
fix(numeric-editor): fix numeric editor spin button style when setting editable mode #2165
Lipata added a commit that referenced this issue Nov 30, 2021
fix(numeric-editor): fix numeric editor spin button style when setting editable mode #2165
@PlamenaMiteva
Copy link
Contributor

PlamenaMiteva commented Dec 1, 2021

Hi @IG-Mori ,

the bug with the numeric editor disabled styles not being applied to the spin buttons when switching from disabled has been fixed and will be included into this service release.
As a workaround you can apply the disabled class to the spin button in the valueChanged event handler:
$('#chkbox').igCheckboxEditor({ size: 'small', valueChanged: function (e, args) { $('#numEditor').igNumericEditor('option', 'disabled', $('#chkbox').igCheckboxEditor('value')); var disabled = $('#numEditor').igNumericEditor('option', 'disabled'); var value = $('#numEditor').igNumericEditor('option', 'value'); var minValue = $('#numEditor').igNumericEditor('option', 'minValue'); if (!disabled && value === minValue) { var downButton = $('#numEditor').igNumericEditor("spinDownButton"); downButton.addClass('ui-state-disabled'); downButton.off("mouseenter.button mouseleave.button mousedown.button mouseup.button click.button"); } } });

@IG-Mori
Copy link
Author

IG-Mori commented Dec 2, 2021

Hi @PlamenaMiteva ,

Thank you for your support!

I added spinUpButton processing to the workaround.
This worked for both the up and down buttons.

$('#chkbox').igCheckboxEditor({ size: 'small', valueChanged: function (e, args) { $('#numEditor').igNumericEditor('option', 'disabled', $('#chkbox').igCheckboxEditor('value')); var disabled = $('#numEditor').igNumericEditor('option', 'disabled'); var value = $('#numEditor').igNumericEditor('option', 'value'); var minValue = $('#numEditor').igNumericEditor('option', 'minValue'); var maxValue = $('#numEditor').igNumericEditor('option', 'maxValue'); if (!disabled && value === minValue) { var downButton = $('#numEditor').igNumericEditor("spinDownButton"); downButton.addClass('ui-state-disabled'); downButton.off("mouseenter.button mouseleave.button mousedown.button mouseup.button click.button"); } else if (!disabled && value === maxValue) { var upButton = $('#numEditor').igNumericEditor("spinUpButton"); upButton.addClass('ui-state-disabled'); upButton.off("mouseenter.button mouseleave.button mousedown.button mouseup.button click.button"); } } });

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