Skip to content

Commit 02cacb8

Browse files
committed
Improve translation grid table readability and column management
- Fix column visibility dropdown to properly toggle language columns - Add Select All/Select None buttons to column dropdown for bulk visibility control - Increase language column width from 200px to 300px for better readability - Enable text wrapping in cells to prevent truncation of long translations - Enable column resizing for both key and language columns - Add explicit Width property to fix column distribution issues
1 parent 698758d commit 02cacb8

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

cloud/src/LrmCloud.Web/Components/TranslationGrid.razor

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@
3434
}
3535

3636
<RadzenSplitButton Text="Columns" Icon="view_column" Variant="Radzen.Variant.Outlined" Size="ButtonSize.Small"
37-
Click="@(args => { })" Style="margin-top: auto;">
37+
Click="@OnColumnMenuClick" Style="margin-top: auto;">
3838
<ChildContent>
39+
<RadzenSplitButtonItem Text="Select All" Value="__SELECT_ALL__" Icon="check_box" />
40+
<RadzenSplitButtonItem Text="Select None" Value="__SELECT_NONE__" Icon="check_box_outline_blank" />
3941
@foreach (var lang in Languages)
4042
{
4143
var langCode = lang;
@@ -84,6 +86,7 @@
8486
AllowFiltering="false"
8587
AllowSorting="true"
8688
AllowPaging="true"
89+
AllowColumnResize="true"
8790
PageSize="50"
8891
PageSizeOptions="@(new int[] { 25, 50, 100, 200 })"
8992
PagerHorizontalAlign="HorizontalAlign.Right"
@@ -93,6 +96,7 @@
9396
AllowRowSelectOnRowClick="false"
9497
RowClick="@OnRowClick"
9598
EditMode="Radzen.DataGridEditMode.Single"
99+
class="translation-grid"
96100
Style="height: calc(100vh - 320px);"
97101
RowStyle="cursor: pointer;">
98102

@@ -148,7 +152,7 @@
148152
</RadzenDataGridColumn>
149153

150154
@* Key name *@
151-
<RadzenDataGridColumn TItem="TranslationGridRow" Property="KeyName" Title="Key" Width="250px" Frozen="true">
155+
<RadzenDataGridColumn TItem="TranslationGridRow" Property="KeyName" Title="Key" Width="250px" Frozen="true" Resizable="true">
152156
<Template Context="row">
153157
@{
154158
var keyIssues = GetKeyValidationIssues(row.KeyName);
@@ -196,7 +200,7 @@
196200
@foreach (var lang in VisibleLanguages)
197201
{
198202
var langCode = lang;
199-
<RadzenDataGridColumn TItem="TranslationGridRow" Title="@GetLanguageTitle(lang)" MinWidth="200px" Sortable="false">
203+
<RadzenDataGridColumn TItem="TranslationGridRow" Title="@GetLanguageTitle(lang)" Width="300px" MinWidth="250px" Sortable="false" Resizable="true">
200204
<Template Context="row">
201205
@{
202206
var cell = row.IsPlural
@@ -394,8 +398,7 @@
394398

395399
private static string GetCellStyle(string value)
396400
{
397-
if (value.Length > 50)
398-
return "overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; display: block;";
401+
// Text wrapping is now handled by CSS, no need for inline styles
399402
return "";
400403
}
401404

@@ -473,6 +476,28 @@
473476
StateHasChanged();
474477
}
475478

479+
private void OnColumnMenuClick(RadzenSplitButtonItem item)
480+
{
481+
if (item?.Value != null)
482+
{
483+
var value = item.Value.ToString();
484+
if (value == "__SELECT_ALL__")
485+
{
486+
_hiddenLanguages.Clear();
487+
StateHasChanged();
488+
}
489+
else if (value == "__SELECT_NONE__")
490+
{
491+
_hiddenLanguages = new HashSet<string>(Languages);
492+
StateHasChanged();
493+
}
494+
else
495+
{
496+
ToggleLanguageVisibility(value!);
497+
}
498+
}
499+
}
500+
476501
private void OnSelectAllChanged(bool value)
477502
{
478503
_selectAll = value;

cloud/src/LrmCloud.Web/wwwroot/css/app.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,9 @@ div.rz-sidebar {
956956

957957
.translation-grid .rz-cell {
958958
vertical-align: top;
959+
white-space: normal !important;
960+
word-wrap: break-word;
961+
overflow-wrap: break-word;
959962
}
960963

961964
.translation-cell-missing {

0 commit comments

Comments
 (0)