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
Give developers access to the collection of columns in a DataGrid.
馃 Expected Behavior
In order to programmatically set the sort, remove sort, or show column options, you need to pass in a ColumnBase<TGridItem> into one of the methods, RemoveSortByColumnAsync, ShowColumnOptionsAsync, and SortByColumnAsync. As far as I can tell, there is no way to get a reference to the columns.
馃槸 Current Behavior
Currently there is way to access this collection.
馃拋 Possible Solution
There is a private field that contains a list of ColumnBase<TGridItem> that could be exposed through a getter property.
馃敠 Context
What I'm trying to accomplish is to store the state of the DataGrid and restore it when navigating back to the page. I have filters and paging working, now I need to be able to restore the previous sort order. I can accomplish this by storing an index/unique id of the column that was sorted and then applying the SortByColumnAsync method.
馃捇 Examples
I think this is fairly straight-forward. Basically add a new property in fluentui-blazor/src/Core/Components/DataGrid/FluentDataGrid.razor.cs
public List<ColumnBase<TGridItem>> Columns { get => _columns; }
Alternatively, methods could be created to give access to these columns, GetColumnByTitle or GetColumnByIndex
The text was updated successfully, but these errors were encountered:
By exposing a getter, you would have read only access to the collection of columns. But then nothing would stop you from manipulating the individuial columns from that collection, right?
I see more value in providing the other type of methods you mention.
As we only have limited time for working on this, care to work on a PR?
馃檵 Feature Request
Give developers access to the collection of columns in a DataGrid.
馃 Expected Behavior
In order to programmatically set the sort, remove sort, or show column options, you need to pass in a
ColumnBase<TGridItem>
into one of the methods,RemoveSortByColumnAsync
,ShowColumnOptionsAsync
, andSortByColumnAsync
. As far as I can tell, there is no way to get a reference to the columns.馃槸 Current Behavior
Currently there is way to access this collection.
馃拋 Possible Solution
There is a private field that contains a list of
ColumnBase<TGridItem>
that could be exposed through a getter property.馃敠 Context
What I'm trying to accomplish is to store the state of the DataGrid and restore it when navigating back to the page. I have filters and paging working, now I need to be able to restore the previous sort order. I can accomplish this by storing an index/unique id of the column that was sorted and then applying the
SortByColumnAsync
method.馃捇 Examples
I think this is fairly straight-forward. Basically add a new property in
fluentui-blazor/src/Core/Components/DataGrid/FluentDataGrid.razor.cs
public List<ColumnBase<TGridItem>> Columns { get => _columns; }
Alternatively, methods could be created to give access to these columns,
GetColumnByTitle
orGetColumnByIndex
The text was updated successfully, but these errors were encountered: