You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using MatChipSet.SelectedChips to preselect displayed chips in OnAfterRender, the comparison is done on a Hash of the MatChip, so a match will never be found.
As a result, chips cannot be preselected. Suggested fix below...
Reproduction Steps
Use the code in the sample/demo application on the 'Chip' page.
In the 'Filter ChipSet' section, replace the line MatChip[] selectedChips = null;
with MatChip[] selectedChips = new MatChip[] { new MatChip() { Label = "Wedges" } };
In the Razor file, add a ref value to the MatChipSet:-
When using MatChipSet.SelectedChips to preselect displayed chips in OnAfterRender, the comparison is done on a Hash of the MatChip, so a match will never be found.
As a result, chips cannot be preselected. Suggested fix below...
Reproduction Steps
Use the code in the sample/demo application on the 'Chip' page.
In the 'Filter ChipSet' section, replace the line
MatChip[] selectedChips = null;
with
MatChip[] selectedChips = new MatChip[] { new MatChip() { Label = "Wedges" } };
In the Razor file, add a ref value to the MatChipSet:-
Override the OnAfterRender method to set the selected chips:-
Expected Result
The 'Wedges' chip should be selected when the page is shown.
Actual Result
All chips are deselected.
Suggested Fix
In MatChipSet.cs, at line 75, match on the Label value, not a hash of the MatChip object:-
Replace
With
I'd have submitted a pull request, but I'm not a registered contributor...
The text was updated successfully, but these errors were encountered: