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

Custom Grid Filter Type to show only Blank/Non Blanks

7 Answers 1180 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 27 Jun 2012, 11:34 PM
Hi there,

I'm trying to setup some custom filter types on my grid (using server filtering) to show only Blank or Non-blank rows.  Add add the custom filters to the columns and see my new items in the dropdown.  So far so good.  However, when I select either of those and then don't type anything in the text boxes the FilterMenu's _merge() function removes them from the filter as there is no value in the text box.  Is there any way I can currently get around this without modifying the _merge() to not remove filters with my new types if the filter text is empty?  Or is there any other way to accomplish this type of filter?

Thanks,
Matt

Here's my current column filterable setup in case it helps:
{
    extra: true,
    operators: {
        string: {
            eq: "Is equal to",
            neq: "Is not equal to",
            startswith: "Starts with",
            contains: "Contains",
            endswith: "Ends with",
            blank:"Is blank",
            notblank:"Is not blank"
        },
        number: {
            eq: "Is equal to",
            neq: "Is not equal to",
            gte: "Is greater than or equal to",
            gt: "Is greater than",
            lte: "Is less than or equal to",
            lt: "Is less than",
            blank:"Is blank",
            notblank:"Is not blank"
        },
        date: {
            eq: "Is equal to",
            neq: "Is not equal to",
            gte: "Is after or equal to",
            gt: "Is after",
            lte: "Is before or equal to",
            lt: "Is before",
            blank: "Is blank",
            notblank: "Is not blank"
        }
    }
}

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Jul 2012, 07:16 AM
Hello Matt,

I am afraid there is not another way to enable this behavior in the filter menu besides modifying the method. You should override the function in the grep method so that it returns true when the blank/notblank operator is used e.g.

filters = $.grep(filters, function(filter) {
    return  filter.operator.indexOf("blank") >= 0 || filter.value !== "";
});
Another option is to create an external filter input and use the dataSource filter method to filter the Grid. Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Deepak
Top achievements
Rank 1
answered on 09 May 2013, 08:02 AM
Hey Daniel,

I am also looking for this feature, but I am not sure how & where to use your code, can you point out to some sample to implement this functionality.
0
Daniel
Telerik team
answered on 14 May 2013, 08:24 AM
Hello,

There is not a sample because as I mentioned in my previous reply, this feature is not supported. You may consider opening a feature request in our user voice forum. 
The approach that I suggested in my previous reply was to modify the code for the FilterMenu. Specifically the _merge function so that an empty string is considered as valid value. If client filtering is used, then the operators should also be added in the kendo.data file. Besides modifying the code, you could also use an external filter or add some custom buttons to the filter menu in the fitlerMenuInit event and use the filter method with the "eq", "neq" operators to filter the data.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Andrei
Top achievements
Rank 1
answered on 18 Jul 2014, 03:57 PM
I know this is old post, but we are trying to implement this functionality now and it looks like Kendo Grid filters still not support filter by NULL/empty or NOT NULL/not empty.

Can you please advise if you have such a feature on the roadmap or I need to request it?

Also, if you have an example (and can share it :-)) on how I can implement it using external filter approach (if it is still suggested) - that will be terrific!


Thank you,

Andrei
0
Alexander Valchev
Telerik team
answered on 23 Jul 2014, 09:05 AM
Hello Andrei,

This feature is still not available, but is already submitted at Kendo UI Feedback portal. You can cast a vote for it and track its status here.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Shiva
Top achievements
Rank 1
answered on 11 Aug 2015, 07:58 PM
can i filter using the "eq", "neq" for blank strings? Tried but the grid is not posting for that filter value. 
0
Alexander Valchev
Telerik team
answered on 14 Aug 2015, 10:46 AM
Hi Shiva,

This functionality is still not available. Please cast a vote for it at the link from my previous reply.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Deepak
Top achievements
Rank 1
Andrei
Top achievements
Rank 1
Alexander Valchev
Telerik team
Shiva
Top achievements
Rank 1
Share this question
or