Class ActionEventArgs<T>
Provides information about the OnActionBegin event when grid action start's. Also, provides information about the OnActionComplete event when grid action completed. Provides information about the OnActionBegin event when a grid action begins and the OnActionComplete event when a grid action is completed.
Inherited Members
Namespace: Syncfusion.Blazor.Grids
Assembly: Syncfusion.Blazor.dll
Syntax
public class ActionEventArgs<T> : GridEventBaseArgs
Type Parameters
Name | Description |
---|---|
T | TValue of the grid component. |
Constructors
ActionEventArgs()
Declaration
public ActionEventArgs()
Properties
Action
Gets the CUD (Create, Update, Delete) actions that can be performed when the edit mode is set to Normal or Dialog.
Declaration
public string Action { get; }
Property Value
Type | Description |
---|---|
System.String | The possible values for this property are:
The default value of this property is null. |
Cancel
Gets or sets a value indicating whether to cancel the current action.
Declaration
public bool Cancel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is |
CheckboxListData
Declaration
public IEnumerable<object> CheckboxListData { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | An IEnumerable collection of objects that serve as the custom data source for the CheckBox and Excel filter types in grid, By default the value is |
Code
Gets the string that identifies the physical key being pressed, while saving the edited record using Enter or Tab keys in Normal edit mode.
Declaration
public string Code { get; set; }
Property Value
Type | Description |
---|---|
System.String |
|
Remarks
The value of this property is assigned while performing the save operation using Enter or Tab keyboard keys. In this case, RequestType will be 'Save', and the Action will be 'Edit'. If no save operation has been performed, the value of this property will be null.
ColumnName
Gets or sets the Field name associated with the current column based on the current actions like Grouping
, Sorting
, and Filtering
.
Declaration
public string ColumnName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The field name associated with the current column based on the current actions like |
Columns
Gets the System.Collections.Generic.List<> of PredicateModel<T> of the filtered columns.
Declaration
public List<PredicateModel<object>> Columns { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<PredicateModel<System.Object>> | A System.Collections.Generic.List<> of PredicateModel<T> objects representing the filtered columns. When the filter type is Excel or CheckBox, this property will contain the filtered columns. Otherwise, the value of this property will be null. |
CurrentFilteringColumn
Gets or sets the Field name of the column that is currently being filtered.
Declaration
public string CurrentFilteringColumn { get; set; }
Property Value
Type | Description |
---|---|
System.String | The field name of the column that is currently being filtered, when |
CurrentFilterObject
Gets the PredicateModel<T> that is currently filtered.
Declaration
public PredicateModel<object> CurrentFilterObject { get; set; }
Property Value
Type | Description |
---|---|
PredicateModel<System.Object> | When |
CurrentPage
Gets or sets the current page number.
Declaration
public int CurrentPage { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The current page number, The default value is 0. |
Data
Gets or sets the data of the grid for the current actions like grouping, filtering, sorting etc...
Declaration
public T Data { get; set; }
Property Value
Type | Description |
---|---|
T | A |
Direction
Gets the direction of the sorted column.
Declaration
public SortDirection Direction { get; set; }
Property Value
Type |
---|
SortDirection |
Remarks
The available sort directions are:
- SortDirection.Ascending: Default, sorts records in ascending order.
- SortDirection.Desending: Sorts records in descending order.
EditContext
Gets or sets the current EditContext instance.
Declaration
public EditContext EditContext { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.Forms.EditContext | An instance of the EditContext class that represents the current edit context. By default, the value is null. |
ExcelSearchOperator
Gets or sets the Excel search operator.
Declaration
public Operator ExcelSearchOperator { get; set; }
Property Value
Type | Description |
---|---|
Operator | The Operator enum value that represents the selected search operator. |
Remarks
Use this property to get or set the operator that will be used to filter data based on Excel-style search criteria. The available operators are specified by the Operator enum. The default value is None. The available operators are:
- None: No operator is selected. For example, if we set None
- Contains: Checks whether the value contains the specified value. For example, if we set Contains and the search term is "an", then the item would contains "an", columns to be filtered.
- StartsWith: Checks whether the value begins with the specified value. For example, if we set StartsWith and the search term is "an", then the item would startswith "an", columns to be filtered.
- EndsWith: Checks whether the value ends with the specified value. For example, if we set EndsWith and the search term is "an", then the item would endswith "an", columns to be filtered.
- Equal: Checks whether the value is equal to the specified value. For example, if we set Equal and the search term is "an", then the item would equal to "an", columns to be filtered.
- NotEqual: Checks for values not equal to the specified value. For example, if we set NotEqual and the search term is "an", then the item would notequal to "an", columns to be filtered.
- GreaterThan: Checks whether the value is greater than the specified value. For example, if we set GreaterThan and the search term is "10", then the item would greaterthan to "10", columns to be filtered.
- GreaterThanOrEqual: Checks whether a value is greater than or equal to the specified value. For example, if we set GreaterThanOrEqual and the search term is "10", then the item would greaterthan or equal to "10", columns to be filtered.
- LesserThan: Checks whether the value is less than the specified value. For example, if we set LessThan and the search term is "10", then the item would lessthan to "10", columns to be filtered.
- LesserThanOrEqual: Checks whether the value is less than or equal to the specified value. For example, if we set LessThanOrEqual and the search term is "10", then the item would lessthan or equal to "10", columns to be filtered.
FilterChoiceCount
Gets or sets the number of data to take while filtering.
Declaration
public int FilterChoiceCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of data to take while filtering, By default the value is 0. |
FilterOperators
Gets or sets the custom filter operators.
Declaration
public List<object> FilterOperators { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Object> | A list of objects that represent the custom filter operators. By default, the value is null. |
ForeignKeyData
Gets the foreign key column data.
Declaration
public IDictionary<string, IEnumerable<object>> ForeignKeyData { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IEnumerable<System.Object>> | A dictionary that represents the foreign key column data. Each key represents a foreign key column name and the value represents the associated data as an enumerable object. |
Form
Gets or sets the form element.
Declaration
public DOM Form { get; set; }
Property Value
Type |
---|
DOM |
FromColumns
Gets the list of columns to be moved while the Reorder action is performed.
Declaration
public List<GridColumn> FromColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GridColumn> | The list of GridColumn to be moved in the grid when the columns are reordered. If the column is not reordered, then the value of this property will be null. |
HiddenColumns
Gets the list of hidden GridColumn which is selected in column chooser.
Declaration
public List<GridColumn> HiddenColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GridColumn> | A list of columns that represents the hidden columns using the column chooser. |
Index
Gets or sets the index of the row to be added.
Declaration
public int Index { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index at which the row will be added to the grid. By default, the value is 0. |
IsShiftKeyPressed
Gets the boolean value that identifies whether the Shift-Tab
key was pressed to save the edited record in Normal edit mode.
Declaration
public bool IsShiftKeyPressed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the |
Remarks
Corresponding value has been assigned while performing the save operation using Shift-Tab
keyboard keys, also RequestType will be 'Save' and the Action will be 'Edit'. Otherwise value is null.
MovableForm
Define the movable table form element.
Declaration
public DOM MovableForm { get; set; }
Property Value
Type |
---|
DOM |
PreventDataClone
Gets or sets whether to clone data object during editing. Set the property when the OnActionBegin event is triggered with RequestType
as BeforeBeginEdit
.
Declaration
public bool PreventDataClone { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A boolean value that indicates whether the data object should be cloned or not when editing begins. The possible values for this property are:
|
Remarks
If PreventDataClone
is set to true
, the edited data will be saved even if the user discards the changes using the Cancel button in the toolbar.
PreventFilterQuery
Gets or Sets whether to prevent the grid column’s default filter query during the API call.
Declaration
public bool PreventFilterQuery { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | The default value is |
Remarks
By default, when a filter is applied to a grid column, the grid sends a default filter request with the column name and filter value to the server.
In some cases, the default filter request may be too long and exceed URL length limitations, resulting in a long URI exception. This property provides an option to generate a custom filter query for a specific grid column and override the default filter request.
To use this property, set it to true in the OnActionBegin
event with RequestType
as Filtering
, and override the ProcessCustomFilterQuery
method in the adaptor.
Examples
@implements IDisposable
<SfGrid AllowFiltering="true">
<GridEvents TValue="Book" OnActionBegin="OnActionBegin"/>
<GridForeignColumn @nameof(Book.CustomerId)>
<SfDataManager @ref="DataManagerRef" Url="http://localhost:64956/odata/customers" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager>
</GridForeignColumn>
</SfGrid>
@code{
SfGrid<Order> Grid;
public SfDataManager DataManagerRef { get; set; }
public static Query CustomQuery = new Query();
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
DataManagerRef.DataAdaptor = new TestOData(DataManagerRef);
}
base.OnAfterRender(firstRender);
}
void IDisposable.Dispose()
{
CustomQuery = null;
}
public class TestOData : ODataV4Adaptor
{
public TestOData(DataManager dm) : base(dm)
{
}
public override Query ProcessCustomFilterQuery(Query query)
{
return CustomQuery;
}
}
private void OnActionBegin(Syncfusion.Blazor.Grids.ActionEventArgs<Book> args)
{
if(args.RequestType == Syncfusion.Blazor.Grids.Action.FilterSearchBegin)
{
if(args.SearchString != string.Empty)
{
args.SearchString = string.Empty;
args.CheckboxListData = new List<Book>() { new Book() { Id = Guid.NewGuid(), CustomerId = Guid.NewGuid(), CustomerId1 = Guid.NewGuid(), Active = false, CreditLimit = 20 }};
}
}
if (args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.ClearFiltering))
{
CustomQuery = new Query();
}
if (args.RequestType == Syncfusion.Blazor.Grids.Action.Filtering)
{
if (String.Equals(args.CurrentFilteringColumn, null, StringComparison.OrdinalIgnoreCase) && String.Equals(args.CurrentFilterObject?.Field, "Name", StringComparison.OrdinalIgnoreCase))
{
CustomQuery = new Query();
}
if (String.Equals(args.CurrentFilteringColumn, nameof(Book.CustomerId), StringComparison.OrdinalIgnoreCase))
{
args.PreventFilterQuery = true;
List<WhereFilter> AndPredicate = new List<WhereFilter>();
if (args.Columns != null)
{
foreach (var col in args.Columns)
{
AndPredicate.Add(new WhereFilter() { Field = "Customer/Name", Operator = col.Operator.ToString().ToLower(), value = col.Value, Condition = col.Predicate });
}
if (AndPredicate[0].Condition == "and")
{
CustomQuery = new Query().Where(new WhereFilter() { Condition = "and", IsComplex = true, predicates = AndPredicate });
}
else
{
CustomQuery = new Query().Where(new WhereFilter() { Condition = "or", IsComplex = true, predicates = AndPredicate });
}
}
else if (args.Columns == null)
{
CustomQuery = new Query().Where("Customer/Name", args.CurrentFilterObject.Operator.ToString().ToLower(), args.CurrentFilterObject.Value, true, true);
}
}
}
}
}
PreviousData
Gets the previous data of the row.
Declaration
public T PreviousData { get; set; }
Property Value
Type | Description |
---|---|
T | An object of type T that contains the previous data of the row. By default, the value is null. |
PreviousPage
Gets or sets the previous page number. The default value is 0.
Declaration
public int PreviousPage { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The page number of the previous page. |
PrimaryKeys
Gets or sets the list of the primary key values.
Declaration
public string[] PrimaryKeys { get; set; }
Property Value
Type | Description |
---|---|
System.String[] | A string array that contains the list of primary key values. |
PrimaryKeyValue
Gets the primary key value of the GridColumn.
Declaration
public object PrimaryKeyValue { get; set; }
Property Value
Type | Description |
---|---|
System.Object | An object that defines the primary key value of the column when IsPrimaryKey is true, otherwise null. |
RequestType
Gets the current Action in the grid like sorting, filtering, grouping, and etc.
Declaration
public Action RequestType { get; }
Property Value
Type | Description |
---|---|
Action | The current action being performed in the grid. |
Remarks
The request type assigned to the grid depends on the actions performed. The available request types include:
- Add: When adding a new record in the normal or dialog edit mode enabled DataGrid.
- BeforeBeginEdit: Before the current record becomes editable state in the normal or dialog edit mode enabled DataGrid (occurs only in OnActionBegin event).
- BeginEdit: After the current record becomes editable state in the normal or dialog edit mode enabled DataGrid.
- Save: When saving a record in the normal or dialog edit mode enabled DataGrid.
- Delete: When deleting a record in the normal or dialog edit mode enabled DataGrid.
- Cancel: When canceling an edit operation in the normal or dialog edit mode enabled DataGrid.
- Filtering: When filtering data in the DataGrid.
- FilterBeforeOpen: Before opening the filter dialog for Menu, Excel and CheckBox filter types (occurs only in OnActionBegin event.).
- FilterChoiceRequest: While fetching data to render the filtering checkboxes in Excel or CheckBox filter type.
- FilterAfterOpen: After a filter dialog is opened (occurs only in When a filter dialog is opened. It will assigned only in OnActionComplete event).
- Sorting: When sorting data in the DataGrid.
- Grouping: When grouping data in the DataGrid.
- UnGrouping: When ungrouping a column in the DataGrid.
- Paging: When navigating pages in the DataGrid.
- Reorder: When reordering a column in the DataGrid.
- RowDragAndDrop: When dragging and dropping rows in the DataGrid.
Row
Defines the added row.
Declaration
public DOM Row { get; set; }
Property Value
Type |
---|
DOM |
RowData
Gets the data of the row.
Declaration
public T RowData { get; set; }
Property Value
Type | Description |
---|---|
T | The data of the row. |
RowIndex
Gets the edited rowIndex.
Declaration
public int RowIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The edited row index. By default, the value is 0. |
Remarks
The value of this property can be used to identify which row in a collection or a data source has been edited.
SearchString
Gets or sets the string value to search.
Declaration
public string SearchString { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts the string value. |
SelectedRow
Gets the index of the currently selected row.
Declaration
public int SelectedRow { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the currently selected row. By default, the value is 0. |
Target
Defines the target for dialog.
Declaration
public DOM Target { get; set; }
Property Value
Type |
---|
DOM |
ToColumn
Gets the destination columns to place the reordered columns while the Reorder action is performed in the grid.
Declaration
public GridColumn ToColumn { get; set; }
Property Value
Type | Description |
---|---|
GridColumn | The destination GridColumn to place the reordered columns in the grid when the columns are reordered. If the column is not reordered, then the value of this property will be null. |
Tr
Defines the selected rows for delete.
Declaration
public List<DOM> Tr { get; set; }
Property Value
Type |
---|
System.Collections.Generic.List<DOM> |
Type
Gets the type of the event.
Declaration
public string Type { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value that represents the type of the event. |
VisibleColumns
Gets the list of visible columns in the column chooser.
Declaration
public List<GridColumn> VisibleColumns { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GridColumn> | A list of GridColumn that represents the visible columns in the grid, By default the value is |