Add row focusing support to CatalogsGrid and MassDataGrid
Enable row focusing in both grid components by introducing the focusedRowKey property and binding it to the grid. After create or update operations, set focusedRowKey to the affected item's key, ensuring the grid automatically focuses the relevant row. Improves user experience by highlighting newly created or updated items.
This commit is contained in:
@@ -128,6 +128,8 @@ else
|
|||||||
CustomizeEditModel="OnCustomizeEditModel"
|
CustomizeEditModel="OnCustomizeEditModel"
|
||||||
EditModelSaving="OnEditModelSaving"
|
EditModelSaving="OnEditModelSaving"
|
||||||
DataItemDeleting="OnDataItemDeleting"
|
DataItemDeleting="OnDataItemDeleting"
|
||||||
|
FocusedRowEnabled="true"
|
||||||
|
@bind-FocusedRowKey="focusedRowKey"
|
||||||
@ref="gridRef">
|
@ref="gridRef">
|
||||||
<Columns>
|
<Columns>
|
||||||
@RenderColumns()
|
@RenderColumns()
|
||||||
@@ -171,6 +173,7 @@ else
|
|||||||
private EditContext? editContext;
|
private EditContext? editContext;
|
||||||
private ValidationMessageStore? validationMessageStore;
|
private ValidationMessageStore? validationMessageStore;
|
||||||
private IGrid? gridRef;
|
private IGrid? gridRef;
|
||||||
|
private int? focusedRowKey;
|
||||||
private string popupHeaderText = "Edit";
|
private string popupHeaderText = "Edit";
|
||||||
private const string LayoutType = "GRID_BANDS";
|
private const string LayoutType = "GRID_BANDS";
|
||||||
private const string LayoutKey = "CatalogsGrid";
|
private const string LayoutKey = "CatalogsGrid";
|
||||||
@@ -347,6 +350,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
infoMessage = "Katalog angelegt.";
|
infoMessage = "Katalog angelegt.";
|
||||||
|
focusedRowKey = created.Value.Guid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -359,6 +363,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
infoMessage = "Katalog aktualisiert.";
|
infoMessage = "Katalog aktualisiert.";
|
||||||
|
focusedRowKey = editModel.Guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
await LoadCatalogs();
|
await LoadCatalogs();
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ else
|
|||||||
CustomizeEditModel="OnCustomizeEditModel"
|
CustomizeEditModel="OnCustomizeEditModel"
|
||||||
EditModelSaving="OnEditModelSaving"
|
EditModelSaving="OnEditModelSaving"
|
||||||
DataItemDeleting="OnDataItemDeleting"
|
DataItemDeleting="OnDataItemDeleting"
|
||||||
|
FocusedRowEnabled="true"
|
||||||
|
@bind-FocusedRowKey="focusedRowKey"
|
||||||
@ref="gridRef">
|
@ref="gridRef">
|
||||||
<Columns>
|
<Columns>
|
||||||
@RenderColumns()
|
@RenderColumns()
|
||||||
@@ -208,6 +210,7 @@ else
|
|||||||
private EditContext? editContext;
|
private EditContext? editContext;
|
||||||
private ValidationMessageStore? validationMessageStore;
|
private ValidationMessageStore? validationMessageStore;
|
||||||
private IGrid? gridRef;
|
private IGrid? gridRef;
|
||||||
|
private int? focusedRowKey;
|
||||||
private const string LayoutType = "GRID_BANDS";
|
private const string LayoutType = "GRID_BANDS";
|
||||||
private const string LayoutKey = "MassDataGrid";
|
private const string LayoutKey = "MassDataGrid";
|
||||||
private const string LayoutUserStorageKey = "layoutUser";
|
private const string LayoutUserStorageKey = "layoutUser";
|
||||||
@@ -676,8 +679,9 @@ else
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Api.UpsertAsync(dto);
|
var saved = await Api.UpsertAsync(dto);
|
||||||
infoMessage = editModel.IsNew ? "MassData angelegt." : "MassData aktualisiert.";
|
infoMessage = editModel.IsNew ? "MassData angelegt." : "MassData aktualisiert.";
|
||||||
|
focusedRowKey = saved.Id;
|
||||||
await LoadPage(pageIndex);
|
await LoadPage(pageIndex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user