Hide filter for Grid Command Column

Hi there

I know that I can hide the filter textbox above any column with the following code:
<GridColumn Field=@nameof(Release.CountOfReleaseNotes) HeaderText="Anz. Einträge" TextAlign="TextAlign.Right" AllowEditing="false">
  <FilterTemplate></FilterTemplate>
</GridColumn>

How can I achieve the same thing for a Grid Command Column?

This is the whole Grid-Definition:
<SfGrid @ref="_releaseGrid" DataSource="@ReleasesList" AllowExcelExport="true" AllowPaging="true" AllowFiltering="true" Toolbar="@ToolbarItems"
        ContextMenuItems="@(new List<object>() { "AutoFit", "AutoFitAll", "Copy", "Edit", "FirstPage", "PrevPage","LastPage", "NextPage"})">
  <GridEvents TValue="Release" OnActionBegin="GridActionBegin" CommandClicked="OnCommandClicked" RowSelected="GetSelectedRecord"></GridEvents>
  <GridEditSettings Mode="EditMode.Dialog" AllowAdding="true" AllowEditing="true" AllowDeleting="false" AllowEditOnDblClick="true"></GridEditSettings>

  <GridColumns>
    <GridColumn Field=@nameof(Release.Id) HeaderText="ID" IsPrimaryKey="true" Visible="false"></GridColumn>
    <GridColumn Field=@nameof(Release.ProjectId) HeaderText="Projekt-ID" Visible="false" DefaultValue="@ProjectId"></GridColumn>
    <GridColumn Field=@nameof(Release.VersionNumber) HeaderText="Version"></GridColumn>
    <GridColumn Field=@nameof(Release.ReleaseDate) HeaderText="Datum" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right"></GridColumn>
    <GridColumn Field=@nameof(Release.IsPreRelease) HeaderText="Pre-Release" TextAlign="TextAlign.Center" DisplayAsCheckBox="true"></GridColumn>
    <GridColumn Field=@nameof(Release.Notes) HeaderText="Bemerkungen"></GridColumn>
    <GridColumn Field=@nameof(Release.CountOfReleaseNotes) HeaderText="Anz. Einträge" TextAlign="TextAlign.Right" AllowEditing="false">
      <FilterTemplate></FilterTemplate>
    </GridColumn>
    <GridColumn >
      @* How to hide filter text box? *@
      <GridCommandColumns>
        <GridCommandColumn Title="ReleaseNotes" ButtonOption="@(new CommandButtonOptions() { Content = "Release-Notes", CssClass = "e-flat" })"></GridCommandColumn>
      </GridCommandColumns>
    </GridColumn>
  </GridColumns>
</SfGrid>

Thank you for your help
Regards, Michael

3 Replies 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team November 5, 2020 09:47 AM UTC

Hi Michael,  
 
Thanks for contacting Syncfusion support.  
 
Query: “How can I achieve the same thing for a Grid Command Column? 
 
We have analyzed your query and we have achieved your requirement using FilterTemplate tag of GridColumn. To render FilterTemplate and GridCommandColumn in same GridColumn, we suggest you use ChildContent tag like below. Refer the below code example. 
 
<SfGrid DataSource="@Orders" AllowPaging="true" AllowFiltering="true"> 
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" EditType="EditType.DatePickerEdit" Format="d" TextAlign="TextAlign.Right" Width="130"></GridColumn> 
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn HeaderText="Manage Records" Width="150"> 
            <FilterTemplate></FilterTemplate> 
            <ChildContent> 
                <GridCommandColumns> 
                    <GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-edit", CssClass = "e-flat" })"></GridCommandColumn> 
                    <GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-delete", CssClass = "e-flat" })"></GridCommandColumn> 
                    <GridCommandColumn Type="CommandButtonType.Save" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-update", CssClass = "e-flat" })"></GridCommandColumn> 
                    <GridCommandColumn Type="CommandButtonType.Cancel" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-cancel-icon", CssClass = "e-flat" })"></GridCommandColumn> 
                </GridCommandColumns> 
            </ChildContent> 
        </GridColumn> 
    </GridColumns> 
</SfGrid> 
 
 
For your convenience we have prepared a sample using above solution which can be downloaded from below  
 
 
Please get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan 


Marked as answer

MH Michael Hachen November 5, 2020 10:03 AM UTC

Hi Vignesh 

Thank you for your help - it works great!

Have a good day and stay save!
Michael


RS Renjith Singh Rajendran Syncfusion Team November 6, 2020 01:20 PM UTC

Hi Michael, 

Thanks for your update. 

We are glad to hear that our suggestion helped you in achieving this requirement. 

Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon