Telerik Forums
Kendo UI for Angular Forum
0 answers
21 views

Hello!

I have a grid filter is specified as "menu"  ([filterable]="'menu'")

Some the grid columns are created dynamically like this:

<kendo-grid-column *ngFor="let c of myColumnsObjects"
        field="{{ c.name }}"
        title="{{ c.title }}"
    >
    <ng-template
          kendoGridFilterMenuTemplate
          let-column="column"
          let-filter="filter"
          let-filterService="filterService"
        >
          <app-mycolumn-filter
            [field]="column.field"
            [filterService]="filterService"
            [currentFilter]="filter"
            [distinctData1]="getDistinctData1(column.field)"
            [distinctData2]="getDistinctData2(column.field)"
            [distinctData3]="getDistinctData3(column.field)"
          ></app-mycolumn-filter>
        </ng-template>
    <ng-template 
      kendoGridCellTemplate 
      let-dataItem >
        <ng-container *ngIf="getObjectByColumnName(c.name, dataItem) as myItem">
          <div class="{{getClassByObject(myItem)}}">
            <div>{{myItem.dataOfField1}}</div>
            <div>{{myItem.dataOfField2}}</div>
            <div>{{myItem.dataOfField3}}</div>
          </div>
        </ng-container>
    </ng-template>
    </kendo-grid-column>

Where

myColumnsObjects is

interface IMyDynamicallyColumn {
  name: string;
  title: string;
}

dataItems is array of

interface IMyData {
  id: number;
  name: string;
  somecomlexobject: any;
  ....
  myItems: IMyItem[];
  otheItems: IOtherItem[];
}

myItem is: 

interface IMyItem {
  id: number;
  dataOfField1: string;
  dataOfField2: number;
  dataOfField3: EMyItemState;
}

const enum EMyItemState {
  State1 = 'state1',
  State2 = 'state2',
  ...
  State<N> = 'state<n>'
}


Input data   distinctData1, distinctData2 and distinctData3 used in angular's component of app-mycontrol-filter.

In this case, the standard filter does not work.

How can I organize a filter on an objects (type is IMyItem) associated with a column using all the properties of the object?

 

Vsevolod
Top achievements
Rank 1
Iron
 asked on 13 Mar 2024
1 answer
33 views

Hi!

I implemented a filter over all columns to implement a search like the example in the Overview-section for the Grid component.

I would like to highlight all text in the columns yellow that match the entered search text.

Is that easily possible?

Best regards,

Gerald

Zornitsa
Telerik team
 answered on 22 Feb 2024
1 answer
28 views

Hello,

I'm planning on migrating an old AngularJS 1.5.5 (working with KendoUI) to latest angular 17.X with Kendo UI and I have some questions about Odata integration.

 

Is filtering, paging and sorting working "built-in" with odata ? I couldn't find any documentation forfiltering, for ex, with odata.

Do you have any example ?

 

Kind regards,

Musab

Zornitsa
Telerik team
 answered on 12 Jan 2024
2 answers
44 views

Hi!

i want replace a input text with a dropdownlist-filter inside this default filter, i need to keep this filter: CONTAINS ... - AND / OR - CONTAINS ...

Can someone help me?

Thanks!! 

Andrea
Top achievements
Rank 1
Iron
 answered on 10 Jan 2024
0 answers
25 views
hi, I have a column with multiple object values ​​and I need to bind each id to default filter menu but kendo only allows me to bind an unique id via input (fieldName).
Is there a way to send multiple ids? or i have to create a custom component and add my logic there
marc
Top achievements
Rank 1
 asked on 09 Jan 2024
1 answer
27 views
Hi, there, so atm I'm trying to implement a custom filter menu, with kendo multiselect component, but I'm having some issues. So, what's happening it's that the filtering it's not working properly and I think the issue comes beacuse it's not getting the right currentFilter state. When I open the filter button it seems to do the filtering ok, but when I reopen the button, the filters selected previosly don't appear in the ui, despite the filtering persisting and I'm not able to unselect any filter at all, and if i try to filter again selecting new values it will just add the values to the currentFilter and perfoms the filtering adding the new values, plus the ones before. 


custom-component.ts

export class CustomMultiSelectFilterComponent implements AfterViewInit {

  @Output() public handleFilterChange = new EventEmitter<CompositeFilterDescriptor>()

  @Input() public data: string[] = []
  @Input() public textField: string = ""
  @Input() public valueField: string = ""
  @Input() public filter: CompositeFilterDescriptor = { logic: "or", filters: [] }
  @Input() public preFilterValue: string | null = null
  @Input() public filterService: FilterService
  @Input() public currentFilter: CompositeFilterDescriptor = { logic: "or", filters: [] }

  public constructor(
    filterService: FilterService
  ) {
    this.filterService = filterService
  }

  public filterChange(filter: CompositeFilterDescriptor): void {
    this.filter = filter
    this.data = filterBy(this.data , filter)
    this.handleFilterChange.emit(filter)
  }

  public onChange(values: string[], filterService: FilterService): void {
    filterService.filter({
      filters: values.map((value) => ({
        field: this.valueField,
        operator: "contains",
        value,
      })),
      logic: "or",
    })
  }

  public ngAfterViewInit(): void {
    if (this.filterService) {
      this.filterService.changes.subscribe((filter: CompositeFilterDescriptor) => {
        this.currentFilter = filter
        console.log("Current Filters:", this.currentFilter)
      })
    }
  }

}


custom-filter.html

<kendo-multiselect
  [data]="data"  
  [valuePrimitive]="true"
  [textField]="textField"
  [valueField]="valueField"
  [value]="filter | filterValues"
  (valueChange)="onChange($event, filterService)"
  >
</kendo-multiselect>

table.html


<kendo-grid
  kendoGridSelectBy="id"
  [kendoGridBinding]="users"
  filterable="menu"
  [sortable]="true"
  [resizable]="true"
  (selectionChange)="selectionChange($event)"
  [selectable]="selectableSettings"
  [selectedKeys]="[selectedKeyArray]"
  (filterChange)="handleFilterChange($event)"
  [filter]="filter"
>
  <kendo-grid-column-group title="{{ 'literal:Users | Total:' | translate }} {{ users.length }}" [columnMenu]="true">
    <kendo-grid-column field="roles" title="{{ 'literal:Roles' | translate }}" [width]="220" [headerStyle]="{ 'font-weight': 'bold' }">
      <ng-template kendoGridFilterMenuTemplate let-filter="filter" let-filterService="filterService">
        <app-custom-multiselect-filter
          [data]="rolesToFilter"
          textField="rolesToFilter"
          valueField="filterRoles"
          [preFilterValue]="preFilter"
          [filterService]="filterService"
          [currentFilter]="filter"
          >
        </app-custom


Yanmario
Telerik team
 answered on 02 Jan 2024
1 answer
46 views

Hello!

Our customer complained that when trying to enter a decimal point in the numeric filter of the grid, it appears and then immediately disappears. This effect appeared after upgrading the kendo-angular-grid package from version 4.7.0 to version 11.2.0 (we also upgraded the Angular version from version 10 to 15). I noticed that the same effect is present on your site

https://www.telerik.com/kendo-angular-ui/components/grid/filtering/filter-menu/

Notice the Order column in the 1st example there. Please open a filter for it and try to quickly (as fast as possible) enter a number and then a dot in the top input of the filter. 
The same thing happens in the other examples on this page that have a numeric filter. Interestingly, there is no such effect in the lower inputs.

So my questions are: 
1. is this a defect?
2. is it possible to fix this behaviour without changing the version of the kendo-angular-grid package? I mean, maybe there is a possibility to intercept an input event in the filter input in an Angular component code.

Martin Bechev
Telerik team
 answered on 29 Nov 2023
1 answer
168 views

I have a scenario, where I have to filter the grid based on a Boolean column.

for ex: "isMember" is a boolean field with  "yes" or "No" values

The user can filter records with :

"yes":- to see only member records,[checked= true]

"No":-  to see non-member records[checked = fslse]

and "both yes and No":- to see all records[checked=null]

 The Prime-ng has a p-triStateCheckbox component to implement this scenario.

Do we have something similar in kendo to implement this scenario?

Hetali
Telerik team
 answered on 18 Oct 2023
0 answers
47 views
I have a column in the kendo grid that contains years.
are numeric values without decimals.
but when I use filter=numeric and look for a year I get 2 decimal digits.
how can i set the filter without decimals?
Tera
Top achievements
Rank 1
Iron
Iron
 asked on 03 Aug 2023
2 answers
67 views

Hi team,

On the external filtering sample under the grid, I wanted a filter condition like the below :

(Product Name starts with 'c' And Product Name ends with 'i') OR Product Name is equal to  'Ikura'

Using this filter, I expected to get chai and ikura as filtered results.  but the filter gave me zero results back.

Can you please tell me why this selection of filters gave no results back? Also, what filters do I need to use to accomplish my requirement of getting chai and ikura as my results?

I am attaching the screen capture of my selected filter options for your reference.

Regards,
Naresh Ravlani.

 
Naresh
Top achievements
Rank 1
Iron
 answered on 22 May 2023
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?