diff --git a/src/Core/Components/DataGrid/FluentDataGrid.razor.cs b/src/Core/Components/DataGrid/FluentDataGrid.razor.cs index 04ab45fc9f..0d6d96e78e 100644 --- a/src/Core/Components/DataGrid/FluentDataGrid.razor.cs +++ b/src/Core/Components/DataGrid/FluentDataGrid.razor.cs @@ -511,6 +511,12 @@ public Task RemoveSortByColumnAsync(ColumnBase column) return RefreshDataCoreAsync(); } + /// + /// Removes the grid's sort on double click for the currently sorted column if it's not a default sort column. + /// + /// A representing the completion of the operation. + public Task RemoveSortByColumnAsync() => (_sortByColumn != null) ? RemoveSortByColumnAsync(_sortByColumn) : Task.CompletedTask; + /// /// Displays the UI for the specified column, closing any other column /// options UI that was previously displayed. @@ -525,6 +531,29 @@ public Task ShowColumnOptionsAsync(ColumnBase column) return Task.CompletedTask; } + /// + /// Displays the UI for the specified column found first, + /// closing any other column options UI that was previously displayed. If the title is not found, nothing happens. + /// + /// The column title whose options UI is to be displayed. + /// A representing the completion of the operation. + public Task ShowColumnOptionsAsync(string title) + { + var column = _columns.FirstOrDefault(c => c.Title?.Equals(title, StringComparison.InvariantCultureIgnoreCase) ?? false); + return (column is not null) ? ShowColumnOptionsAsync(column) : Task.CompletedTask; + } + + /// + /// Displays the UI for the specified column , + /// closing any other column options UI that was previously displayed. If the index is out of range, nothing happens. + /// + /// The column index whose options UI is to be displayed. + /// A representing the completion of the operation. + public Task ShowColumnOptionsAsync(int index) + { + return (index >= 0 && index < _columns.Count) ? ShowColumnOptionsAsync(_columns[index]) : Task.CompletedTask; + } + /// /// Displays the column resize UI for the specified column, closing any other column /// resize UI that was previously displayed. @@ -539,6 +568,29 @@ public Task ShowColumnResizeAsync(ColumnBase column) return Task.CompletedTask; } + /// + /// Displays the column resize UI for the specified column, closing any other column + /// resize UI that was previously displayed. + /// + /// The column title whose resize UI is to be displayed. + /// A representing the completion of the operation. + public Task ShowColumnResizeAsync(string title) + { + var column = _columns.FirstOrDefault(c => c.Title?.Equals(title, StringComparison.InvariantCultureIgnoreCase) ?? false); + return (column is not null) ? ShowColumnResizeAsync(column) : Task.CompletedTask; + } + + /// + /// Displays the column resize UI for the specified column, closing any other column + /// resize UI that was previously displayed. + /// + /// The column index whose resize UI is to be displayed. + /// A representing the completion of the operation. + public Task ShowColumnResizeAsync(int index) + { + return (index >= 0 && index < _columns.Count) ? ShowColumnResizeAsync(_columns[index]) : Task.CompletedTask; + } + public void SetLoadingState(bool loading) { Loading = loading;