Skip to content

Fix null reference exception for multi column filtering in MatTable#668

Merged
enkodellc merged 2 commits into
SamProf:masterfrom
akovac35:akovac35-patch-1
Oct 8, 2020
Merged

Fix null reference exception for multi column filtering in MatTable#668
enkodellc merged 2 commits into
SamProf:masterfrom
akovac35:akovac35-patch-1

Conversation

@akovac35

@akovac35 akovac35 commented Aug 3, 2020

Copy link
Copy Markdown
Contributor

Fixed a null reference exception.

Fixed a null reference exception.
@akovac35 akovac35 changed the title Update MatTable.razor Fix null reference exception for multi column filtering in MatTable.razor Aug 4, 2020
@akovac35 akovac35 changed the title Fix null reference exception for multi column filtering in MatTable.razor Fix null reference exception for multi column filtering in MatTable Aug 4, 2020
@SamProf

SamProf commented Sep 5, 2020

Copy link
Copy Markdown
Owner

Thank you for contribution.
Maybe this will be also solution?

properties.Where(x => x.GetValue(item, null)?.ToString() != null).Select(x => x.GetValue(item, null)?.ToString());

@akovac35

akovac35 commented Sep 6, 2020

Copy link
Copy Markdown
Contributor Author

I can only comment about my code, please use it because it fixes a problem with multi column filtering.

@akovac35

akovac35 commented Sep 6, 2020

Copy link
Copy Markdown
Contributor Author

And the second ? is not needed because the final select is never null.

@akovac35

akovac35 commented Oct 3, 2020

Copy link
Copy Markdown
Contributor Author

Can I help with anything related to this merge?

@enkodellc

enkodellc commented Oct 7, 2020

Copy link
Copy Markdown
Collaborator

var values = properties.Where(x => x.GetValue(item, null)?.ToString() != null).Select(x => x.GetValue(item, null).ToString());

@akovac35 I like this code, closer to what we have and solves the problem. I think this is what Samprof was thinking. If you want to update your PR for this code I will merge. Your thoughts?

Also I suggest adding the multi Column example in the demo so others can see and test it live:

FilterByColumnName="Fat;Protein"

@enkodellc
enkodellc merged commit 11d6a3c into SamProf:master Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants