Hello,
I'm trying to add some logging to the grids. For example when user change page size I would like to log new selected value. At the moment ActionEventArgs does not provide any information paging action.
So if I need to log something like I mention above I must use grid reference which containts PageSettings.PageSize
Since Syncfusion.Blazor.Grids.Action.Paging is used for page size and for page selection events I cannot distinct if its a page change or page size change, hence I just want to log page size changes
In addition to that if I would like to log how users use filters how I can do that? since there is no info ActionEventArgs provide on filtering parameters
In addition to that, if I add Print toolbar button Toolbar="@(new List<string>() { "Print","Search", })" after pressing pring button none OnActionBegin or OnActionComplete is trigerred
Could you advice how this can be done?
|
<SfGrid @ref="Grid" DataSource="@Orders" AllowFiltering="true" AllowPaging="true">
<GridPageSettings PageSizes="true"></GridPageSettings>
<GridEvents OnActionBegin="ActionBeginHandler" TValue="Order"></GridEvents>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid>
@code{
SfGrid<Order> Grid { get; set; }
public List<Order> Orders { get; set; }
//default value.
public int Current_PageSize { get; set; } = 12;
public void ActionBeginHandler(ActionEventArgs<Order> Args)
{
//will be triggerd when initiating some action in pager component.
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Paging)
{
if (Grid.PageSettings.PageSize != Current_PageSize)
{
Current_PageSize = Grid.PageSettings.PageSize;
Console.WriteLine(Grid.PageSettings.PageSize.ToString());
//log the page size here.
}
}
//will be triggered when initiating the iltering operation.
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Filtering)
{
//Args.CurrentFilteringColumn return the current filter operation requested column
Console.WriteLine("Column:");
Console.WriteLine(Args.CurrentFilteringColumn);
//Args.CurrentFilterObject - return the current filter options.
}
}
|