DxTreeListCommandColumn.FilterRowCellTemplate Property
Specifies a template used to display the command column’s filter row cell.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public RenderFragment<TreeListCommandColumnFilterRowCellTemplateContext> FilterRowCellTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment<TreeListCommandColumnFilterRowCellTemplateContext> | A template for the command column’s filter row cell. |
Remarks
The command column displays predefined New, Edit, and Delete buttons for data rows in display mode. In EditRow
and EditCell
edit modes, this column displays Save and Cancel buttons for the edited row. In the filter row, the column displays the Clear button.
Define the FilterRowCellTemplate
to display custom content in the command column’s filter row cell. Use the template’s context
parameter to access CommandColumn and TreeList objects and obtain information about their states.
The following example displays the custom Clear button in the command column’s filter row cell. The button’s click handler calls the ClearFilter() method.
@inject EmployeeTaskService EmployeeTaskService
<DxTreeList @ref="MyTreeList"
Data="TreeListData"
KeyFieldName="Id"
ParentKeyFieldName="ParentId"
ShowFilterRow="true"
EditModelSaving="TreeList_EditModelSaving"
DataItemDeleting="TreeList_DataItemDeleting"
CustomizeEditModel="TreeList_CustomizeEditModel">
<Columns>
<DxTreeListCommandColumn>
<FilterRowCellTemplate>
<DxButton Text="Clear" Click="@(() => MyTreeList.ClearFilter())" />
</FilterRowCellTemplate>
</DxTreeListCommandColumn>
<DxTreeListDataColumn FieldName="Name" Caption="Task" />
<DxTreeListDataColumn FieldName="EmployeeName" />
<DxTreeListDataColumn FieldName="StartDate" />
<DxTreeListDataColumn FieldName="DueDate" />
</Columns>
</DxTreeList>
@code {
ITreeList MyTreeList { get; set; }
List<EmployeeTask> TreeListData { get; set; }
protected override void OnInitialized() {
TreeListData = EmployeeTaskService.GenerateData();
}
void TreeList_CustomizeEditModel(TreeListCustomizeEditModelEventArgs e) {
if(e.IsNew) {
var newTask = (EmployeeTask)e.EditModel;
newTask.Id = TreeListData.Max(x => x.Id) + 1;
if(e.ParentDataItem != null)
newTask.ParentId = ((EmployeeTask)e.ParentDataItem).Id;
}
}
async Task TreeList_EditModelSaving(TreeListEditModelSavingEventArgs e) {
if(e.IsNew)
TreeListData.Add((EmployeeTask)e.EditModel);
else
e.CopyChangesToDataItem();
}
async Task TreeList_DataItemDeleting(TreeListDataItemDeletingEventArgs e) {
TreeListData.Remove((EmployeeTask)e.DataItem);
}
}