Skip to content

Commit 4d67533

Browse files
rajrakuRaj Kumar Sri Ramulu
and
Raj Kumar Sri Ramulu
authoredMar 2, 2025
879 filter textbox width unit fix (vikramlearning#1058)
* Added Filter Textbox width unit property to make it configurable * Updated example to show the box is configurable --------- Co-authored-by: Raj Kumar Sri Ramulu <rajkumar.sriramulu@willowglensystems.com>
1 parent 2abb78f commit 4d67533

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed
 

‎BlazorBootstrap.Demo.RCL/Components/Pages/Grid/01-Overview/Grid_Demo_01_Client_Side_Filtering_Paging_And_Sorting.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<GridColumn TItem="Employee1" HeaderText="Id" PropertyName="Id" SortKeySelector="item => item.Id">
1515
@context.Id
1616
</GridColumn>
17-
<GridColumn TItem="Employee1" HeaderText="Employee Name" PropertyName="Name" SortKeySelector="item => item.Name">
17+
<GridColumn TItem="Employee1" HeaderText="Employee Name" PropertyName="Name" FilterTextboxWidth="50" FilterTextboxWidthUnit="Unit.Percentage" SortKeySelector="item => item.Name">
1818
@context.Name
1919
</GridColumn>
2020
<GridColumn TItem="Employee1" HeaderText="Designation" PropertyName="Designation" SortKeySelector="item => item.Designation">

‎blazorbootstrap/Components/Grid/Grid.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
GridColumnFilterChanged="async args => await column.OnFilterChangedAsync(args, column)"
7070
PropertyType="@column.GetPropertyType()"
7171
PropertyTypeName="@column.GetPropertyTypeName()"
72-
Unit="@Unit" />
72+
Unit="@column.FilterTextboxWidthUnit" />
7373
}
7474
</th>
7575
}

‎blazorbootstrap/Components/Grid/GridColumn.razor.cs

+9
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,15 @@ private async Task OnSortClickAsync()
248248
[Parameter]
249249
public int FilterTextboxWidth { get; set; }
250250

251+
/// <summary>
252+
/// Gets or sets the filter textbox width units.
253+
/// </summary>
254+
/// <remarks>
255+
/// Default value is <see cref="Unit.Px" />.
256+
/// </remarks>
257+
[Parameter]
258+
public Unit FilterTextboxWidthUnit { get; set; } = Unit.Px;
259+
251260
/// <summary>
252261
/// Gets or sets the filter value.
253262
/// </summary>

‎blazorbootstrap/Components/Grid/GridColumnFilter.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ or StringConstants.PropertyTypeNameDecimal
183183
[Parameter]
184184
public GridFiltersTranslationDelegate FiltersTranslationProvider { get; set; } = default!;
185185

186-
private string filterStyle => FilterWidth > 0 ? $"width:{FilterWidth.ToString(CultureInfo.InvariantCulture)}{Unit.ToString().ToLower()};" : "";
186+
private string filterStyle => FilterWidth > 0 ? $"width:{FilterWidth.ToString(CultureInfo.InvariantCulture)}{Unit.ToCssString()};" : "";
187187

188188
/// <summary>
189189
/// Gets or sets filter value.

0 commit comments

Comments
 (0)
Please sign in to comment.