MudDataGrid: Sorting causes Unhandled exception
See original GitHub issueBug type
Component
Component name
MudDataGrid
What happened?
Sorting causes Unhandled exception at
var removedSortDefinitions = new HashSet<string>(SortDefinitions.Keys);
It says SortDefinitions are managed by the data grid automatically when using the built-in filter UI.
So is this a bug, or in case of using TemplateColumn I need to specify SortDefinitions?
It was working fine in the previous version with the Column component, I was doing its job without me specifying any sorting mechanisms.
Unhandled exception rendering component: Value cannot be null. (Parameter 'key')
System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at MudBlazor.MudDataGrid`1.SetSortAsync(String field, SortDirection direction, Func`2 sortFunc)
at MudBlazor.HeaderCell`1.SortChangedAsync(MouseEventArgs args)
Expected behavior
As in the previous version, it shouldn’t cause an exception when trying to sort items and could do it in some default behavior.
Reproduction link
https://try.mudblazor.com/snippet/GaQnaRGwIaHRPlKU
Reproduction steps
- Specify columns in datagrid with TemplateColumn component
- Try to sort any sortable column
…
Relevant log output
No response
Version (bug)
6.2.0
Version (working)
6.1.9
What browsers are you seeing the problem on?
Firefox, Chrome, Microsoft Edge
On what operating system are you experiencing the issue?
Windows
Pull Request
- I would like to do a Pull Request
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created 6 months ago
- Comments:21 (12 by maintainers)
Top Results From Across the Web
Data Grid
A sortable, filterable data grid with multiselection and pagination. ... The <MudDataGrid> is used to display and work with small amounts of data...
Read more >c# - DataGridView column sort exception
There are two possible causes of this issue, either you have not bound your DataGridView or you are using an incorrect column name....
Read more >DataGrid sorting and filtering stopped working
Hello,. All of the actions in DataGrid suddenly stopped working. ... Unhandled exception rendering component: Object reference not set to an ...
Read more >Unhandled exception rendering component: Value cannot ...
Hi I have created a Blazor WA app and I have added a DxDataGrid component. Everything works fine: the grid is correctly populated...
Read more >Stack Overflow while sorting a grid in UI for WinForms
No matter what I try I am getting a stackoverflow error on the CellValueNeeded event anytime I try to sort any of my...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am aware of several instances where developers are attempting to do this with datagrd. I will work on a best practice example.
Not a solution but temporary fix.
Hope it helps until fix is out.