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

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

Merged
merged 2 commits into from
Oct 8, 2020

Conversation

akovac35
Copy link
Contributor

@akovac35 akovac35 commented Aug 3, 2020

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
Copy link
Owner

SamProf commented Sep 5, 2020

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
Copy link
Contributor Author

akovac35 commented Sep 6, 2020

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

@akovac35
Copy link
Contributor Author

akovac35 commented Sep 6, 2020

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

@akovac35
Copy link
Contributor Author

akovac35 commented Oct 3, 2020

Can I help with anything related to this merge?

@enkodellc
Copy link
Collaborator

enkodellc commented Oct 7, 2020

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