Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/Core/Components/DataGrid/FluentDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,12 @@ public Task RemoveSortByColumnAsync(ColumnBase<TGridItem> column)
return RefreshDataCoreAsync();
}

/// <summary>
/// Removes the grid's sort on double click for the currently sorted column if it's not a default sort column.
/// </summary>
/// <returns>A <see cref="Task"/> representing the completion of the operation.</returns>
public Task RemoveSortByColumnAsync() => (_sortByColumn != null) ? RemoveSortByColumnAsync(_sortByColumn) : Task.CompletedTask;

/// <summary>
/// Displays the <see cref="ColumnBase{TGridItem}.ColumnOptions"/> UI for the specified column, closing any other column
/// options UI that was previously displayed.
Expand All @@ -525,6 +531,29 @@ public Task ShowColumnOptionsAsync(ColumnBase<TGridItem> column)
return Task.CompletedTask;
}

/// <summary>
/// Displays the <see cref="ColumnBase{TGridItem}.ColumnOptions"/> UI for the specified column <paramref name="title"/> found first,
/// closing any other column options UI that was previously displayed. If the title is not found, nothing happens.
/// </summary>
/// <param name="title">The column title whose options UI is to be displayed.</param>
/// <returns>A <see cref="Task"/> representing the completion of the operation.</returns>
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;
}

/// <summary>
/// Displays the <see cref="ColumnBase{TGridItem}.ColumnOptions"/> UI for the specified column <paramref name="index"/>,
/// closing any other column options UI that was previously displayed. If the index is out of range, nothing happens.
/// </summary>
/// <param name="index">The column index whose options UI is to be displayed.</param>
/// <returns>A <see cref="Task"/> representing the completion of the operation.</returns>
public Task ShowColumnOptionsAsync(int index)
{
return (index >= 0 && index < _columns.Count) ? ShowColumnOptionsAsync(_columns[index]) : Task.CompletedTask;
}

/// <summary>
/// Displays the column resize UI for the specified column, closing any other column
/// resize UI that was previously displayed.
Expand All @@ -539,6 +568,29 @@ public Task ShowColumnResizeAsync(ColumnBase<TGridItem> column)
return Task.CompletedTask;
}

/// <summary>
/// Displays the column resize UI for the specified column, closing any other column
/// resize UI that was previously displayed.
/// </summary>
/// <param name="title">The column title whose resize UI is to be displayed.</param>
/// <returns>A <see cref="Task"/> representing the completion of the operation.</returns>
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;
}

/// <summary>
/// Displays the column resize UI for the specified column, closing any other column
/// resize UI that was previously displayed.
/// </summary>
/// <param name="index">The column index whose resize UI is to be displayed.</param>
/// <returns>A <see cref="Task"/> representing the completion of the operation.</returns>
public Task ShowColumnResizeAsync(int index)
{
return (index >= 0 && index < _columns.Count) ? ShowColumnResizeAsync(_columns[index]) : Task.CompletedTask;
}

public void SetLoadingState(bool loading)
{
Loading = loading;
Expand Down