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-4519: Issue with dropdown column with dependency triggering OnCellValueChange event twice #375

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

OS-giulianasilva
Copy link
Contributor

This PR is for fix the dropdown child triggering the OnCellValueChange more than once.

What was happening

  • When the Grid has a dropdown column with dependency, the OnCellValueChange event was triggered twice when the parent cell value changed.

What was done

  • Add validation to check if currentValue is different than empty when adding the child undo action and triggering the OnCellValueChange event.
    • If the currentValue is already empty, we don't need to set the cell value to empty again and add it to the undo stack.
  • Change the way we get the last parent cell's undo action on the undo stack.
    • We want to ensure that the child's undo action is added to the last parent's undo action in the undo stack.
  • Disabled the trigger in the validateCell method to trigger the OnCellValueChange event just once.
    • The onCellValueChange is already explicitly being triggered in the _parentCellValueChangeHandler, We don't need to do this twice.
  • Trigger the OnCellValueChange with the original value instead of currentValue.
    • The OnCellValueChange event must return the original value and not the previous cell value.
  • Added an else statement in ValidationMark's validateCell method to validate the cell event even when not triggering the columns event.

Test Steps

  1. Go to a page containing a Grid with dropdown dependency.
  2. Change the parent cell value
  3. Check that the child's OnCellValueChange is triggered just once for the child dropdown.
  4. Press Ctrl+Z to undo
  5. Check that the child's OnCellValueChange is triggered just once for the child dropdown.

Screenshots

Before the changes:
dropdownDependencyIssue

After the changes:
dropdownDependencyIssueSolved

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)

- Add a validation to check if currentValue is different than empty when adding the child undo action and triggering the OnCellValueChange event.
- Change the way we get the last parent cell's undo action on undo stack
- Disabled the trigger in validateCell method to trigger the OnCellValueChange event just once.
- Trigger the OnCellValueChange with originalValue instead of currentValue
@outsystemsbot outsystemsbot bot added the cla:yes This code submission conforms with the OutSystems CLA or the CLA is not required for this PR label Sep 12, 2023
@sonarcloud
Copy link

sonarcloud bot commented Sep 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@OS-giulianasilva OS-giulianasilva merged commit 525a61c into dev Sep 14, 2023
11 checks passed
@OS-giulianasilva OS-giulianasilva deleted the ROU-4519-2 branch September 14, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes This code submission conforms with the OutSystems CLA or the CLA is not required for this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants