This is a migrated thread and some comments may be shown as answers.

Configuring built-in filters

5 Answers 1427 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chau
Top achievements
Rank 1
Chau asked on 16 Mar 2018, 05:26 PM

From the article https://www.telerik.com/kendo-angular-ui/components/grid/data-operations/filtering/built-in-template/#toc-hiding-row-filter-operators, it seems that I can specify the available filter operators for a grid column.

With the code below, should I expect to only see 'Contains' and 'Is Equal To' in the the filter menu?  I tried but the filter menu shows all filter operators.

<kendo-grid-column field="ProductName" title="Product Name">

   <ng-template kendoGridFilterMenuTemplate let-filter let-column="column" let-filterService="filterService">

       <kendo-grid-string-filter-menu [column]="column" [filter]="filter" [filterService]="filterService">

           <kendo-filter-contains-operator></kendo-filter-contains-operator>

           <kendo-filter-eq-operator></kendo-filter-eq-operator>

       </kendo-grid-string-filter-menu>

   </ng-template>

</kendo-grid-column>

Thanks for any clarification.

5 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 19 Mar 2018, 04:26 PM
Hello Chau,

I tried the provided snippet and it seems to yield the expected result on my end:

https://plnkr.co/edit/4EMO5bQOQKMmU3ycRkoT?p=preview

https://www.telerik.com/kendo-angular-ui/components/grid/data-operations/filtering/built-in-template/#toc-setting-the-order-of-the-filter-operators

Please make sure that the filterable mode is set to "menu" to enable the Grid filter menu functionality (as opposed to the default filter row one). You can inspect the example above and apply the necessary adjustments to your implementation.

If the issue persists, please send us a similar isolated runnable project where the problem can be observed, so we can inspect it further, and determine what might be causing it. Thank you in advance.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Chau
Top achievements
Rank 1
answered on 20 Mar 2018, 01:40 AM

Thanks Dimiter for the clarification.

I was using filterable="true" (which shows the default filter row), and used the kendoGridFilterMenuTemplate, that's why it did not work. I changed to use the kendoGridFilterCellTemplate and the list of filter operators is showing correctly now.

0
Dimiter Topalov
Telerik team
answered on 20 Mar 2018, 09:09 AM
Hi Chau,

Thank you for sharing your experience and the adjustment that lead to resolving the issue.

Regards,
Dimiter Topalov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jubin
Top achievements
Rank 1
answered on 07 May 2020, 01:16 PM

I m new to kendoGridFilterCellTemplate.

I'm using templateref to pass ng-template to the shared kendo grid. So, it looks something like this.

In the page.component.html

<!-- ng template for custom row filter cell mod kendo -->
<ng-template #cellFilterTemplate let-filter let-column="colum">
    <kendo-grid-string-filter-cell [column]="column" [filter]="filter" operator="startswith">
        <kendo-filter-startswith-operator></kendo-filter-startswith-operator>
        <kendo-filter-eq-operator></kendo-filter-eq-operator>
    </kendo-grid-string-filter-cell>
</ng-template>

The above template I'm passing to the shared kendo grid html

In the shared kendogrid.component.html

       <!-- ng template for modding filter type = row -->
                <ng-template *ngIf="col.cellFilterTemplateRef !== undefined" kendoGridFilterCellTemplate let-filter
                    let-column="column">
                    <ng-container *ngTemplateOutlet="col.cellFilterTemplateRef; context:{$implicit:filter,colum: column}">
                    </ng-container>
                </ng-template>

I seem to be getting the two operators namely starts with and equals to, but there is no text in them and also clicking on them don't work. I have attached the image of the problem.

 

 

I have only included the relevant parts of the code.

Thanks.

0
Dimiter Topalov
Telerik team
answered on 11 May 2020, 07:30 AM

Hello Jubin,

We recommend using the template markup directly within the Grid Column markup to ensure it will be working as expected. If a generic custom component is used as a wrapper, and different templates should be used for different Grid columns that are generated dynamically, all templates can be defined within the Grid Column markup, and the desired one could be displayed via *ngIf, e.g.:

https://stackblitz.com/edit/angular-b4gopp?file=app/app.component.ts

As for the specific setup, we cannot determine what is causing the described problem, based on the provided information. I can suggest checking the browser developer tools console for some JavaScript errors that might point you in the right direction. Also, if you send us an isolated runnable project, similar to the one above where the exact setup and the described problem can be observed, we will inspect it further, and try to provide an answer that is most suitable to the specific use case. Thank you in advance.

Regards,
Dimiter Topalov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Chau
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Chau
Top achievements
Rank 1
jubin
Top achievements
Rank 1
Share this question
or