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

ROU-4828: Fix OnCellValueChange event returning newValue = oldValue when it is triggered via SetCellData #446

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

OS-giulianasilva
Copy link
Contributor

@OS-giulianasilva OS-giulianasilva commented Feb 17, 2025

THIS PR STILL NEEDS TO BE PROPERLY VALIDATED.

This PR is for fix OnCellValueChange event returning newValue = oldValue when it is triggered via SetCellData

What was happening

  • The OnCellValueChange is triggered after using the SetCellData returns the NewValue and OldValue parameters returned are the same.
  • There is a not a good reason for it unless bad implementation.
  • The validateCell method validates the cell and triggers the OnCellValueChange event with oldValue = newValue when the triggerOnCellValueChange parameter is true. This method is used in three places:
    • In the DropdownColumn’s _parentCellValueChangeHandler method. The validateCell is called with the triggerOnCellValueChange equals false and then another call is done to trigger the event using the ColumnEvents' trigger method.
    • In the ValidateCell’s API method where the validateCell’s triggerOnCellValueChange parameter depends on what is sent to the API. For this method, it makes sense that the oldValue = newValue, because the cell value does not change.
    • In the SetCellData’s API method where, like the ValidateCell’s API, the validateCell’s triggerOnCellValueChange parameter depends on what is sent to the API.

What was done

  • Removed the part that triggers the OnCellValueChange event from the _parentCellValueChangeHandler method and use the one from the validateCell method
  • Add a new parameter oldValue to the validateCell method to be used in the event trigger.
  • When the oldValue is null/undefined and triggerOnCellValueChange = true , then oldValue needs to be equal newValue.
  • When newValue is null/undefined, then we use the getCellData method.

Test Steps

Screenshots

(prefer animated gif)

Checklist

  • tested locally
  • documented the code
  • clean all warnings and errors of eslint
  • requires changes in OutSystems (if so, provide a module with changes)
  • requires new sample page in OutSystems (if so, provide a module with changes)

When it is triggered via SetCellData.
@OS-giulianasilva OS-giulianasilva added bug Something isn't working do not merge This pull request should not be merged even if checks pass labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working do not merge This pull request should not be merged even if checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant