* Changed ScheduleOrdersGrid with enabling Persistence

* Added div to help with visibility on mobiles
This commit is contained in:
2025-02-19 14:01:39 +01:00
parent 3770d4f28d
commit 59e558b109

View File

@@ -2,58 +2,65 @@
@using Syncfusion.Blazor.Grids
@inherits LayoutComponentBase
<SfGrid @ref="_grid"
TValue="ScheduleOrderDto"
AllowFiltering="true"
AllowPaging="true"
AllowSorting="true"
AllowSelection="true"
DataSource="@_dataSource"
EnableAdaptiveUI="true"
AllowRowClick="true"
SelectionMode="GridSelectionMode.Single"
QueryCellInfo="OnQueryCellInfo"
RowSelected="OnRowSelected">
<GridColumns>
<GridColumn Field=@nameof(ScheduleOrderDto.PONum) HeaderText="Zamówienie Klienta"
Width="150" AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.PurchaserCode) HeaderText="Klient"
Width="100" AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.RecipientName) HeaderText="Odbiorca"
Width="100" AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.LastUpdateDate) HeaderText="Data Utworzenia"
Format="d" Type="ColumnType.Date" Width="130"
AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.DocType) HeaderText="Typ Dokumentu"
Width="100" AllowFiltering="true"></GridColumn>
</GridColumns>
<GridTemplates>
<DetailTemplate>
@{
IList<ScheduleOrderDetailDto>? scheduleOrderDetails = (@context as ScheduleOrderDto)?.ScheduleOrderDetails;
<SfGrid AllowFiltering="true"
AllowPaging="true"
AllowSorting="true"
AllowSelection="true"
TValue="ScheduleOrderDetailDto"
DataSource="@scheduleOrderDetails"
EnableAdaptiveUI="true">
<GridColumns>
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sc_productCode) HeaderText="Pozycja" Width="100"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sh_productCode) HeaderText="Pozycja Klienta"
Width="100"></GridColumn>
</GridColumns>
<GridFilterSettings Type="FilterType.Excel"/>
<GridPageSettings PageSize="10"/>
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
</SfGrid>
}
</DetailTemplate>
</GridTemplates>
<GridEvents TValue="ScheduleOrderDto" OnRecordDoubleClick="OnRowDoubleClick" />
<GridFilterSettings Type="FilterType.Excel" />
<GridPageSettings PageSize="PageSize" />
</SfGrid>
<div class="container-fluid h-100">
<SfGrid @ref="_grid"
TValue="ScheduleOrderDto"
AllowFiltering="true"
AllowPaging="true"
AllowSorting="true"
AllowSelection="true"
DataSource="@_dataSource"
EnableAdaptiveUI="true"
EnablePersistence="true"
AllowRowClick="true"
SelectionMode="GridSelectionMode.Single"
QueryCellInfo="OnQueryCellInfo"
RowSelected="OnRowSelected">
<GridColumns>
<GridColumn Field=@nameof(ScheduleOrderDto.PONum) HeaderText="Zamówienie Klienta"
Width="150" AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.PurchaserCode) HeaderText="Klient"
Width="100" AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.RecipientName) HeaderText="Odbiorca"
Width="100" AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.LastUpdateDate) HeaderText="Data Utworzenia"
Format="d" Type="ColumnType.Date" Width="130"
AllowFiltering="true"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDto.DocType) HeaderText="Typ Dokumentu"
Width="100" AllowFiltering="true"></GridColumn>
</GridColumns>
<GridTemplates>
<DetailTemplate>
@{
IList<ScheduleOrderDetailDto>? scheduleOrderDetails = (@context as ScheduleOrderDto)?.ScheduleOrderDetails;
<SfGrid AllowFiltering="true"
AllowPaging="true"
AllowSorting="true"
AllowSelection="true"
TValue="ScheduleOrderDetailDto"
DataSource="@scheduleOrderDetails"
EnablePersistence="true"
EnableAdaptiveUI="true">
<GridColumns>
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sc_productCode) HeaderText="Pozycja"
Width="100"></GridColumn>
<GridColumn Field=@nameof(ScheduleOrderDetailDto.Sh_productCode)
HeaderText="Pozycja Klienta"
Width="100"></GridColumn>
</GridColumns>
<GridFilterSettings Type="FilterType.Excel"/>
<GridPageSettings PageSize="10"/>
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
</SfGrid>
}
</DetailTemplate>
</GridTemplates>
<GridEvents TValue="ScheduleOrderDto" OnRecordDoubleClick="OnRowDoubleClick"/>
<GridFilterSettings Type="FilterType.Excel"/>
<GridPageSettings PageSize="PageSize"/>
</SfGrid>
</div>
@code {
[Parameter] public required IEnumerable<ScheduleOrderDto> GridData { get; set; }
@@ -84,4 +91,5 @@
int scheduleOrderId = obj.RowData.ID;
NavigationManager.NavigateTo($"/ScheduleOrder/{scheduleOrderId}");
}
}