Skip to content

Commit d660599

Browse files
authored
Table: don't resize columns with FixedPosition (#5925)
* Table: don't resize columns with FixedPosition * Use raw strings * use switch expression
1 parent e81e530 commit d660599

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

Source/Blazorise/Components/Table/TableHeaderCell.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@inherits BaseDraggableComponent
33
<th @ref="@ElementRef" id="@ElementId" scope="col" class="@ClassNames" style="@StyleNames" @onclick="@OnClickHandler" colspan="@ColumnSpan" rowspan="@RowSpan"
44
draggable="@DraggableString"
5+
data-fixed-position="@FixedPositionDataAttribute"
56
@ondragend="@OnDragEndHandler"
67
@ondragend:preventDefault="@DragEndPreventDefault"
78
@ondragenter="@OnDragEnterHandler"

Source/Blazorise/Components/Table/TableHeaderCell.razor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ protected override ValueTask DisposeAsync( bool disposing )
140140

141141
#region Properties
142142

143+
/// <summary>
144+
/// Gets the fixed position data attribute.
145+
/// </summary>
146+
protected string FixedPositionDataAttribute => FixedPosition switch
147+
{
148+
TableColumnFixedPosition.Start => "start",
149+
TableColumnFixedPosition.End => "end",
150+
_ => null
151+
};
152+
143153
/// <summary>
144154
/// Gets or sets the cascaded parent table component.
145155
/// </summary>

Source/Blazorise/Components/Table/TableRowCell.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
@oncontextmenu="@OnContextMenuHandler"
2020
@oncontextmenu:preventDefault="@ContextMenuPreventDefault"
2121
data-caption="@MobileModeCaption"
22+
data-fixed-position="@FixedPositionDataAttribute"
2223
@attributes="@Attributes">
2324
@ChildContent
2425
</td>

Source/Blazorise/Components/Table/TableRowCell.razor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ protected override ValueTask DisposeAsync( bool disposing )
140140

141141
#region Properties
142142

143+
/// <summary>
144+
/// Gets the fixed position data attribute.
145+
/// </summary>
146+
protected string FixedPositionDataAttribute => FixedPosition switch
147+
{
148+
TableColumnFixedPosition.Start => "start",
149+
TableColumnFixedPosition.End => "end",
150+
_ => null
151+
};
152+
143153
/// <summary>
144154
/// Gets or sets the cascaded parent table component.
145155
/// </summary>

Source/Blazorise/wwwroot/table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function initializeResizable(element, elementId, mode) {
127127
return;
128128

129129
// if the column already has both min and max width set, then we don't need to resize it
130-
if (col.style.minWidth && col.style.maxWidth && !col.dataset.resized) {
130+
if (((col.style.minWidth && col.style.maxWidth) || col.dataset.fixedPosition) && !col.dataset.resized) {
131131
return;
132132
}
133133

0 commit comments

Comments
 (0)