<Template> and <FilterTemplate> in same <GridColumn> does not work

I am using SyncFusion.Blazor v 18.1.0.45

If I have a <GridColumn> section that includes both a <Template> section and a <FilterTemplate> section, Only the <Template> section seems to apply. If I comment out the <Template> section, then the <FilterTemplate> content seems to apply.

How can I make these work together?

I See that you have a Section called <GridTemplates> but the documentation only shows an example it being used in combination with templates for rows, not columns. If I am to use ,GridTemplates> how do I identify the intended columns to apply the template to?

  

4 Replies

DA David Adler April 23, 2020 05:08 PM UTC

This may be related to https://www.syncfusion.com/feedback/13759/template-not-rendered-in-initial-load  

If I have both the <FilterTemplate> and <Template> uncommented out for a given column, and do a few filters on other columns that have <FilterTemplate> but no <Template>, then after applying the filter onthe other column, the content of both the <FilterTemplate> and <Template> of the column in question appear and function as expected.

SyncFusion Support - Please confirm if you are seeing this on your end as well.
   


VN Vignesh Natarajan Syncfusion Team April 24, 2020 06:06 AM UTC

Hi David,  
 
Thanks for contacting Syncfusion support  
 
Query: “SyncFusion Support - Please confirm if you are seeing this on your end as well. 
 
Yes, we are able to reproduce the reported issue (FilterTemplate is not rendered properly during the initial render) at our end and it is related to that feedback. Since it is a known issue, we will fix the reported issue and it will be included in our upcoming patch release which is expected to be rolled out on or before 29th April 2020.  
 
Till then we appreciate your patience.   
 
Regards, 
Vignesh Natarajan 



MV Mark Visschers December 3, 2020 08:11 AM UTC

Did you manage to find out to get a combination of templates working?
I'm also trying to apply a FilterTemplate on top of a templated column.

Related question: Is it also possible to apply these FilterTemplates when using Excel like filters?


VN Vignesh Natarajan Syncfusion Team December 4, 2020 05:45 AM UTC

Hi Mark,  
 
Thanks for contacting Syncfusion support.  
 
Query: “I'm also trying to apply a FilterTemplate on top of a templated column. Related question: Is it also possible to apply these FilterTemplates when using Excel like filters? 
 
No. We do not have support for FilterTemplate with Excel Filter. We have provided support to render FilterTemplate for Templated Column. So we suggest you to achieve your requirement by changing the FilterType of particular column to Menu filter and render the DropDownList component using FilterTemplate. Now for that particular column, menu filter with FilterTemplate component will be displayed and for all other columns Excel filter will be shown.  

Refer the below code example.  

<SfGrid @ref="Grid" DataSource="@Orders" AllowFiltering="true"> 
    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" FilterSettings="@(new FilterSettings{Type = Syncfusion.Blazor.Grids.FilterType.Menu })" Width="150"> 
            <FilterTemplate> 
                <SfDropDownList Placeholder="Customer Name" ID="CustomerID" DataSource="@Dropdown" TValue="string" TItem="Data"> 
                    <DropDownListEvents ValueChange="@Change" TItem="Data" TValue="string"></DropDownListEvents> 
                    <DropDownListFieldSettings Value="CustomerID" Text="CustomerID"></DropDownListFieldSettings> 
                </SfDropDownList> 
            </FilterTemplate> 
            <Template Context="supplier"> 
                <div>@((supplier as Order).CustomerID)</div> 
            </Template> 
        </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> 

In above solution, we have changed the FilterType of CustomerID column to Menu using FilterSettings property and defined FilterTemplate to render custom component in Menu Filter.  

For your convenience we have prepared a sample using above solution which can be downloaded from below    


Refer our UG documentation for your reference 


Kindly get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon