ROU-4828: Fix OnCellValueChange event returning newValue = oldValue when it is triggered via SetCellData #446
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
validateCell
method validates the cell and triggers the OnCellValueChange event witholdValue = newValue
when thetriggerOnCellValueChange
parameter is true. This method is used in three places:_parentCellValueChangeHandler
method. ThevalidateCell
is called with thetriggerOnCellValueChange
equals false and then another call is done to trigger the event using the ColumnEvents' trigger method.ValidateCell’s
API method where thevalidateCell’s
triggerOnCellValueChange
parameter depends on what is sent to the API. For this method, it makes sense that theoldValue = newValue
, because the cell value does not change.SetCellData’s
API method where, like theValidateCell’s
API, thevalidateCell’s
triggerOnCellValueChange
parameter depends on what is sent to the API.What was done
_parentCellValueChangeHandler
method and use the one from thevalidateCell
methodoldValue
to thevalidateCell
method to be used in the event trigger.oldValue
is null/undefined andtriggerOnCellValueChange = true
, thenoldValue
needs to be equalnewValue
.newValue
is null/undefined, then we use thegetCellData
method.Test Steps
Screenshots
(prefer animated gif)
Checklist