Skip to content
Prev Previous commit
Next Next commit
Revert renaming GridColumn to ColumnIndex
  • Loading branch information
Alessio Dell Aquila committed Jun 6, 2024
commit 2aab4f9a8a898e72d084d0b51acfd48994307807
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
ο»Ώ<FluentDataGrid id="manualGrid" GenerateHeader=GenerateHeaderOption.None GridTemplateColumns="1fr 1fr" TGridItem="string" role="grid">
<FluentDataGridRow RowType="DataGridRowType.Header" >
<FluentDataGridCell ColumnIndex=1 CellType="DataGridCellType.ColumnHeader">Column 1</FluentDataGridCell>
<FluentDataGridCell ColumnIndex=2 CellType="DataGridCellType.ColumnHeader">Column 2</FluentDataGridCell>
<FluentDataGridCell GridColumn=1 CellType="DataGridCellType.ColumnHeader">Column 1</FluentDataGridCell>
<FluentDataGridCell GridColumn=2 CellType="DataGridCellType.ColumnHeader">Column 2</FluentDataGridCell>
</FluentDataGridRow>
<FluentDataGridRow>
<FluentDataGridCell ColumnIndex=1 >1.1</FluentDataGridCell>
<FluentDataGridCell ColumnIndex=2>1.2</FluentDataGridCell>
<FluentDataGridCell GridColumn=1 >1.1</FluentDataGridCell>
<FluentDataGridCell GridColumn=2>1.2</FluentDataGridCell>
</FluentDataGridRow>
<FluentDataGridRow>
<FluentDataGridCell ColumnIndex=1>2.1</FluentDataGridCell>
<FluentDataGridCell ColumnIndex=2> 2.2</FluentDataGridCell>
<FluentDataGridCell GridColumn=1>2.1</FluentDataGridCell>
<FluentDataGridCell GridColumn=2> 2.2</FluentDataGridCell>
</FluentDataGridRow>
</FluentDataGrid>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@* Sample using SelectedItems *@
<div>Using SelectedItems</div>

<FluentDataGrid Items="@People" ShowHover="true" TGridItem="Person" OnRowClick="@(row => Console.WriteLine($"Row {row.RowIndex} clicked"))" OnCellClick="@(cell => Console.WriteLine($"Cell {cell.ColumnIndex} clicked"))">
<FluentDataGrid Items="@People" ShowHover="true" TGridItem="Person" OnRowClick="@(row => Console.WriteLine($"Row {row.RowIndex} clicked"))" OnCellClick="@(cell => Console.WriteLine($"Cell {cell.GridColumn} clicked"))">
<SelectColumn TGridItem="Person"
SelectMode="@Mode"
RestrictToCheckbox="@RestrictToCheckbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@

private void HandleCellFocus(FluentDataGridCell<SampleGridData> cell)
{
DemoLogger.WriteLine($"Cell focused: {cell.ColumnIndex}");
DemoLogger.WriteLine($"Cell focused: {cell.GridColumn}");
}
}
6 changes: 3 additions & 3 deletions src/Core/Components/DataGrid/FluentDataGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

string? tooltip = col.Tooltip ? @col.RawCellContent(item) : null;

<FluentDataGridCell Column="@col" ColumnIndex=@(colIndex+1) Class="@ColumnClass(col)" Style="@col.Style" @key="@col" TGridItem="TGridItem" Item="@item" title="@tooltip" aria-label="@tooltip">
<FluentDataGridCell Column="@col" GridColumn=@(colIndex+1) Class="@ColumnClass(col)" Style="@col.Style" @key="@col" TGridItem="TGridItem" Item="@item" title="@tooltip" aria-label="@tooltip">
@((RenderFragment)(__builder => col.CellContent(__builder, item)))
</FluentDataGridCell>
}
Expand All @@ -114,7 +114,7 @@
{
var col = _columns[colIndex];

<FluentDataGridCell Class="@("grid-cell-placeholder " + @ColumnClass(col))" Style="@col.Style" @key="@col" Column="@col" ColumnIndex=@(colIndex+1) TGridItem="TGridItem">
<FluentDataGridCell Class="@("grid-cell-placeholder " + @ColumnClass(col))" Style="@col.Style" @key="@col" Column="@col" GridColumn=@(colIndex+1) TGridItem="TGridItem">
@((RenderFragment)(__builder => col.RenderPlaceholderContent(__builder, placeholderContext)))
</FluentDataGridCell>
}
Expand All @@ -133,7 +133,7 @@
else
col.ShowSortIcon = false;

<FluentDataGridCell Column="@col" ColumnIndex=@(colIndex+1) CellType=DataGridCellType.ColumnHeader Class="@("column-header " + @ColumnHeaderClass(col) + (ResizableColumns ? " resizable" : ""))" Style="@col.Style" aria-sort="@AriaSortValue(col)" @key="@col" scope="col" TGridItem="TGridItem">
<FluentDataGridCell Column="@col" GridColumn=@(colIndex+1) CellType=DataGridCellType.ColumnHeader Class="@("column-header " + @ColumnHeaderClass(col) + (ResizableColumns ? " resizable" : ""))" Style="@col.Style" aria-sort="@AriaSortValue(col)" @key="@col" scope="col" TGridItem="TGridItem">
@col.HeaderContent
@if (col == _displayOptionsForColumn)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Components/DataGrid/FluentDataGridCell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@typeparam TGridItem
<fluent-data-grid-cell cell-id="@CellId"
[email protected]()
grid-column=@ColumnIndex
grid-column=@GridColumn
class="@Class"
style="@StyleValue"
@onclick="@(e => HandleOnCellClickAsync(CellId))"
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Components/DataGrid/FluentDataGridCell.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public partial class FluentDataGridCell<TGridItem> : FluentComponentBase
/// This will be applied to the css grid-column-index value applied to the cell.
/// </summary>
[Parameter]
public int ColumnIndex { get; set; }
public int GridColumn { get; set; }

/// <summary>
/// Gets or sets the content to be rendered inside the component.
Expand Down