Declined
Last Updated: 28 Feb 2020 14:12 by ADMIN
Peter
Created on: 21 Feb 2020 16:37
Category: Grid
Type: Feature Request
1
[GRID] Filtering

Issue: unable to filter data by itself written filter handlers.

Current implementation:

/**
 * A complex filter expression. For more information, refer to the [`filterBy`]({% slug api_kendo-data-query_filterby %}) method.
 */
export interface CompositeFilterDescriptor {
    /**
     * The logical operation to use when the `filter.filters` option is set.
     *
     * The supported values are:
     * * `"and"`
     * * `"or"`
     */
    logic: 'or' | 'and';
    /**
     * The nested filter expressions—either [`FilterDescriptor`]({% slug api_kendo-data-query_filterdescriptor %}), or [`CompositeFilterDescriptor`]({% slug api_kendo-data-query_compositefilterdescriptor %}). Supports the same options as `filter`. You can nest filters indefinitely.
     */
    filters: Array<FilterDescriptor | CompositeFilterDescriptor>;
}


Where filter descriptor has next available fields:


export interface FilterDescriptor {
    /**
     * The data item field to which the filter operator is applied.
     */
    field?: string | Function;
    /**
     * The filter operator (comparison).
     *
     * The supported operators are:
     * * `"eq"` (equal to)
     * * `"neq"` (not equal to)
     * * `"isnull"` (is equal to null)
     * * `"isnotnull"` (is not equal to null)
     * * `"lt"` (less than)
     * * `"lte"` (less than or equal to)
     * * `"gt"` (greater than)
     * * `"gte"` (greater than or equal to)
     *
     * The following operators are supported for string fields only:
     * * `"startswith"`
     * * `"endswith"`
     * * `"contains"`
     * * `"doesnotcontain"`
     * * `"isempty"`
     * * `"isnotempty"`
     */
    operator: string | Function;
    /**
     * The value to which the field is compared. Has to be of the same type as the field.
     */
    value?: any;
    /**
     * Determines if the string comparison is case-insensitive.
     */
    ignoreCase?: boolean;
}


In case when we need to filter in array of array items, and Kendo grid does not allow us this functionality out of the box, please provide at least availability to make it by ourselfs. 

My suggestion structure is

export interface FilterDescriptor {
    /**
     * The data item field to which the filter operator is applied.
     */
    field?: string | Function;
    /**
     * The filter operator (comparison).
     *
     * The supported operators are:
     * * `"eq"` (equal to)
     * * `"neq"` (not equal to)
     * * `"isnull"` (is equal to null)
     * * `"isnotnull"` (is not equal to null)
     * * `"lt"` (less than)
     * * `"lte"` (less than or equal to)
     * * `"gt"` (greater than)
     * * `"gte"` (greater than or equal to)
     *
     * The following operators are supported for string fields only:
     * * `"startswith"`
     * * `"endswith"`
     * * `"contains"`
     * * `"doesnotcontain"`
     * * `"isempty"`
     * * `"isnotempty"`
     */
    operator: string | Function;
    /**
     * The value to which the field is compared. Has to be of the same type as the field.
     */
    value?: any;
    /**
     * Determines if the string comparison is case-insensitive.
     */
    ignoreCase?: boolean;

     /** --------------- ADDITIONAL DATA --------------- */
 
     /**
     * Manages filtering operations with data for single row
     */
    handler?: (dataItem: T) :  Observable<boolean> | boolean;
    /**
     * Filter name to display on grid
     */
    name?: Observable<string> | string;
}

Where handler is providing to us availability to filter by ourselfs data in which way.

Thank you.
Best regardings,
Peter Busliuk. 

Tradeix.com, Lohika Inc.
1 comment
ADMIN
Martin Bechev
Posted on: 28 Feb 2020 14:12

Hi Peter,

Thank you for submitting this feature request. 

It seems that the described use case represents a specific scenario that the developer needs to implement with custom logic. Having said that we think that such a built-in feature would not address enough generic problems or use cases. 

In general, when the user filters the Grid, the filterChange (and dataStateChange) event is fired by returning a CompositeFilterDescriptor object (or State object). In the event handler, the developer can capture the filter value, by which the user wants to filter the Grid and recursively filter the inner arrays. That is why we will have to decline this feature request.

Thank you for the provided feedback once again.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.