If we include the searchbox into the toolbar list, how do we get it to function?
@{
List<ItemModel> Toolbaritems = new List<ItemModel>();
Toolbaritems.Add(new ItemModel() { Text = "Expand all", TooltipText = "Expand all", PrefixIcon = "e-expand" });
Toolbaritems.Add(new ItemModel() { Text = "Collapse all", TooltipText = "Collapse all", PrefixIcon = "e-collapse" });
Toolbaritems.Add(new ItemModel() { Text = "Quick Filter", TooltipText = "Quick Filter", Id = "toolbarfilter" });
Toolbaritems.Add(new ItemModel() { Text = "Print", TooltipText = "Print", Id = "print" });
Toolbaritems.Add(new ItemModel() { Text = "Search", TooltipText = "Search", Id = "search" });
Toolbaritems.Add(new ItemModel() { Text = "PDF Export", TooltipText = "Export to a PDF document", Id = "pdfexport" });
Toolbaritems.Add(new ItemModel() { Text = "Excel Export", TooltipText = "Export to a Excel spreadsheet", Id = "excelexport" });
Toolbaritems.Add(new ItemModel() { Text = "CSV Export", TooltipText = "Export to a comma separated file", Id = "csvexport" });
}
< EjsTreeGrid ID="TreeGrid" @ref="TreeGrid" DataSource="@TreeData" IdMapping="OrgUnitId" ParentIdMapping="ParentOrgUnitId" TreeColumnIndex="3"
AllowPaging="true" AllowExcelExport="true" AllowFiltering="true" AllowMultiSorting="true" AllowPdfExport="true"
AllowReordering="true" AllowResizing="true" AllowRowDragAndDrop="true" AllowSorting="true" AutoCheckHierarchy="true"
EnableAltRow="true" EnableCollapseAll="true" EnableHover="true" ShowColumnMenu="true"
Toolbar="Toolbaritems">
< TreeGridEvents TValue="string" OnToolbarClick="Toolbarclick"></TreeGridEvents>
< TreeGridPageSettings PageSizeMode="PageSizeMode.Root" PageSize="50"></TreeGridPageSettings>
< TreeGridEditSettings AllowEditing="true" />
< TreeGridFilterSettings Type="Syncfusion.EJ2.Blazor.TreeGrid.FilterType.Menu"></TreeGridFilterSettings>
< TreeGridColumns>
< TreeGridColumn Field="Id" HeaderText="Id" Width="100" IsPrimaryKey="true" Visible="false" AllowEditing="false"></TreeGridColumn>
< TreeGridColumn Field="ParentId" HeaderText="ParentId" Width="100" Visible="false" AllowEditing="false"></TreeGridColumn>
< TreeGridColumn Field="Code" HeaderText="Code" Width="20"></TreeGridColumn>
< TreeGridColumn Field="Name" HeaderText="Name" Width="40"></TreeGridColumn>
< /TreeGridColumns>
< /EjsTreeGrid>
protected void Toolbarclick(Syncfusion.EJ2.Blazor.Navigations.ClickEventArgs args)
{
if (args.Item.Text == "PDF Export")
{
this.TreeGrid.PdfExport();
}
else if (args.Item.Text == "Excel Export")
{
this.TreeGrid.ExcelExport();
}
else if (args.Item.Text == "CSV Export")
{
this.TreeGrid.CsvExport();
}
else if (args.Item.Text == "Expand all")
{
this.TreeGrid.ExpandAll();
}
else if (args.Item.Text == "Collapse all")
{
this.TreeGrid.CollapseAll();
}
else if (args.Item.Text == "Quick Filter")
{
this.TreeGrid.FilterByColumn("Name", "StartsWith", "Ap");
}
else if (args.Item.Text == "Search")
{
// What do we do here?
}
}