border-width:0px;
border:none;
<SfGrid DataSource="@Orders" AllowFiltering="true" AllowPaging="true">
<GridPageSettings PageSize="5"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" AllowFiltering="false" Width="120">
<FilterTemplate>
<div></div>
</FilterTemplate>
</GridColumn>
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" AllowFiltering="false" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130">
<FilterTemplate>
<div></div>
</FilterTemplate>
</GridColumn>
<GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>
</GridColumns>
</SfGrid> |
Hi,
This logically doesn't work for GridCommandColumns.
Is there a solution ?
Regards.
Hi Jean,
Sorry for the Inconvenience.
We are currently Validating the reported query at our end and we will update the further details shortly. Until then we appreciate your patience.
Regards,
Naveen Palanivel
Hi Jean,
Thanks for your patience.
We have achieved your requirement of hiding the filter bar to GridCommandColumns using JSInterop and the DataBound event of Grid. In the DataBound event of the Grid, we have found the Uid of the Command Column and sent it to the JavaScript method using JSInterop and on the JavaScript side, we have hidden that particular filter bar.
Refer to the below code example.
<SfGrid @ref="GridInstance" DataSource="@Orders" AllowFiltering="true" AllowPaging="true"> <GridEvents DataBound="DataBoundHandler" TValue="Order"></GridEvents> <GridColumns> <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> <GridColumn HeaderText="Manage Records" Width="150"> <GridCommandColumns> <GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-edit", CssClass = "e-flat" })"></GridCommandColumn> </GridCommandColumns> </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> GridInstance { get; set; } public List<Order> Orders { get; set; } public async Task DataBoundHandler() { var cols = GridInstance.Columns; var t = cols.Where(x => x.HeaderText == "Manage Records").FirstOrDefault(); await Runtime.InvokeVoidAsync("RemoveFilterBar", t.Uid); }
function RemoveFilterBar(val) { var filter = document.getElementsByClassName("e-filterbar")[0].querySelectorAll('[e-mappinguid="' + val + '"]'); filter[0].style.visibility = "hidden"; } |
Refer to the sample in the attachments for your reference. Refer to our UG documentation for your reference
https://blazor.syncfusion.com/documentation/datagrid/events#databound
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan
Thanks for your solution,
Very heavy solution, I hope you will put a class that would allow us to distinguish the GridCommandColumns
<div class="e-filterdiv e-fltrinputdiv">
=> <div class="e-filterdiv e-fltrcommanddiv">
Hi Jean,
Thanks for the update
We will get
back to you once the requested improvement is implemented at our end.
Untill then
we request you to achieve the requirement using the solution provided in
precious update
Regards,
Naveen Palanivel