feat(simple-combo/combo): add selectionChanged event#16968
feat(simple-combo/combo): add selectionChanged event#16968georgianastasov wants to merge 17 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new selectionChanged output to IgxSimpleComboComponent so consumers can react after a selection has been applied (as requested in #16655).
Changes:
- Introduces
ISimpleComboSelectionChangedEventArgsand a newselectionChanged@Output(). - Emits
selectionChangedafter applying selection updates insidesetSelection(...). - Adds unit tests for
selectionChangedbehavior and documents the feature inCHANGELOG.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts | Adds selectionChanged API and emits it after selection is applied. |
| projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.spec.ts | Adds unit tests for the new selectionChanged event. |
| CHANGELOG.md | Notes the new selectionChanged event under IgxSimpleCombo. |
projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts
Outdated
Show resolved
Hide resolved
|
Also, it will be great if we can add same event and to the |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
You can also share your feedback on Copilot code review. Take the survey.
projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts
Outdated
Show resolved
Hide resolved
…iteUI/igniteui-angular into ganastasov/feat-16655-master
wnvko
left a comment
There was a problem hiding this comment.
One general question here. Do we have specification for this event? What should this new event do?
The workflow now is like this:
- end user makes new selection
- selection changing is emitted.
- developer may handle changing event. At this point event could be canceled and nothing will happen. However, event arguments could be changed including old selection, new selection and so on.
- if event is not cancelled selection should be changed base on the update values of event arguments.
- event changed should fire. I am not sure this event should be skipped but it is now in some cases. IMO if changing fired then and changed should fire. What values should be put in event argument should be described the specification. For example we may have at first place selection made by end user, then selection updated in changing event and finally selection actually applied to the component after some validation. Which of these three is the new selection changed event should fire with?
Without specification this feature cannot be done!
projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts
Outdated
Show resolved
Hide resolved
We don't have a specification and exact requirements for what the new event should do. When I initially picked this up, it was just a small requested feature for the simple combo, so I started working on it while waiting for review and clarification. However, now that we are looking at adding these events for both the simple and the combo components, plus handling cancelability, the scope has definitely expanded. You are completely right we absolutely cannot proceed without a clear specification for this! |
projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts
Outdated
Show resolved
Hide resolved
projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.ts
Outdated
Show resolved
Hide resolved
wnvko
left a comment
There was a problem hiding this comment.
Update also the README.md files for both combos.
| } | ||
| this._onChangeCallback(args.newValue); | ||
| this._onChangeCallback(this.value); | ||
| if (shouldEmitSelectionEvents) { |
There was a problem hiding this comment.
no need of this check. If shouldEmitSelectionEvents is false we will never end up here.
There was a problem hiding this comment.
This check is actually needed because shouldEmitSelectionEvents is false when newSelection === oldSelection then selectionChanging.emit(args) is skipped, but args.cancel stays false so we still enter if (!args.cancel) then.. _onChangeCallback(this.value) still runs and without the inner check, selectionChanged would fire even though selection did not actually change.. So shouldEmitSelectionEvents === false does not mean we never reach this block.. but it means we should not emit the selection change events. I tested this, and when I remove the check, selectionChanged is fired even when the selection stays the same.
Closes #16655
Additional information (check all that apply):
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)