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

Reducing filter options on grid

17 Answers 1364 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 01 Jun 2012, 10:02 AM
Hi
As default, the filtering options of the Kendogrid are very comprehensive, which is good.
However, when using serverside filtering there is a lot of things to implement on the server to respond to all these options.

I would like omit "is not equal to", "Starts with" and "Ends with" operators - is this configurable?

Best regards
Thomas

17 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 01 Jun 2012, 12:25 PM
Hi Thomas,

Yes, those options are configurable. You could see the syntax in this code library project - if you do not want some type of filters to be available, just omit their definition.
I hope this helps.

All the best,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Dennis
Top achievements
Rank 1
answered on 01 Jun 2012, 05:32 PM
Alex - I have a suggestion that I think would be really nice for grid filtering:  Allow the header to be a text box or dropdown (whatever is appropriate), similar to inline-editing controls used when editing grid rows, to define a simple filter mechanism that offers a simpler alternative to the popups that exist today.

Thanks, Dennis
0
Alexander Valchev
Telerik team
answered on 04 Jun 2012, 12:44 PM
Hello Dennis,

To achieve this I suggest to work with the filter method of the dataSource, thus way you will be able to create a custom filtering that fits in your requirements. Actually we have an on-line example that demonstrates a similar scenario.

Greetings,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
maharajan
Top achievements
Rank 1
answered on 20 Sep 2012, 05:25 AM
Hi
 I am wondering about the Kendo GRID filtering.
 Does this GRID has filter style (similar to Telerik GRID) with inline filtering ?
Please advice me on this.
Regards
Maharajan.P
0
Jerry
Top achievements
Rank 1
answered on 25 Sep 2012, 10:05 PM
I looked through the project posted for this thread, was definitely helpful in showing how to customize the set of operators used for filtering.  But this doesn't apply to those columns implementing the foreign key lookup technique, correct?  The list of operators in that case just defaults to "Is Equal To" and "Is Not Equal To."  Can you confirm?  I'd love to be able to just set it to "Is Equal To" for cases where we just have two items.  Thanks!
0
Alexander Valchev
Telerik team
answered on 28 Sep 2012, 01:40 PM
Hello guys,

@maharajan
I am afraid that the requested functionality is not supported. To filter the grid you could use the build-in popup filter menu or a custom UI and the filter method of the DataSource. 

@Jerry
Yes, the list of filterable operators for a foreign key column contains only those two options. You can customize them through the configuration options. Here is the syntax:
filterable: {
    operators: {
        enums: {
            eq: "Is EQ text",
            neq: "In NEQ text"
        }
    },
    messages: {
        selectValue: "Option Label" //drop down option label
    }
},

I hope this information will help.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sean
Top achievements
Rank 1
answered on 31 Dec 2012, 07:12 PM
Is it possible to set any of these values using  MVC extensions?
0
Alexander Valchev
Telerik team
answered on 02 Jan 2013, 01:06 PM
Hi Sean,

Yes it is possible. Please see the documentation of GridFilterableSettingsBuilder.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Steven
Top achievements
Rank 1
answered on 04 Jan 2013, 04:24 AM
The documentation does not show any example on how to change / limit the operators for MVC. My intellisense only shows an option for bool in filterable. Can you please show an example?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 04 Jan 2013, 08:08 AM
Hello Steven,

As per Alexander's code snippet this setting applied to the grid Level.

You are trying to set this settings at Column Level that's why you faced this issue.

Thanks,
Jayesh Goyani
0
Steven
Top achievements
Rank 1
answered on 04 Jan 2013, 05:37 PM
Thanks for the reply Jayesh, but Alexander's code doesn't help much because I am trying to achieve this through Razor / C# (KendoUI for MVC) and his snippet is javascript. Moreover I would like to set the operators for a specific column, a datetime column as you can see in screenshot. I looked at the example here and this also does not show the Razor code.

Per your advice I am now getting intelisense since I have it in the correct place and I am attempting to figure it out but I have only found options for changing the message and not for limiting which operators I want available for a given data type or field. Or maybe I am missing something obvious, any clarity would be helpful and a code sample would be very helpful.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 09 Jan 2013, 10:21 AM
Hello,

For toolbar filtering you have to add below JS as mentioned in Demo.





Thanks,
Jayesh Goyani
0
Alexander Valchev
Telerik team
answered on 09 Jan 2013, 02:00 PM
Hello guys,

In Kendo MVC wrappers you can set the filterable options for all columns per data type. Here is the syntax:
.Filterable(filterable => {
    filterable.Operators(operators => {
        operators.ForString(strFilter => strFilter.Clear().IsEqualTo("custom eq text"));
    });
    filterable.Extra(false);
})

Setting per column level is not supported in wrappers.
@Steven: If you prefer to use the Razor syntax, what I can recommend is to set the operators for all date columns.
operators.ForDate(dateFilter => dateFilter.Clear().IsEqualTo("custom eq text"));

At this stage we do not have plans to provide an opportunity for setting the filterable options per column in MVC wrappers. Please accept my apology for the inconvenience.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 1
answered on 05 Feb 2013, 03:45 PM
Hi Alexander,

This only seems to work for IsEqualTo

If I replace this to StartsWith or Contains it doesn't work as expected.
I would be happy if I could even have Contains as the default as this is surely the most used (can we do this?)

0
John
Top achievements
Rank 1
answered on 06 Feb 2013, 03:34 PM
Bump

Hi Alexander,

This only seems to work for IsEqualTo

If I replace this to StartsWith or Contains it doesn't work as expected.
I would be happy if I could even have Contains as the default as this is surely the most used (can we do this?)

.Filterable(filterable => {
    filterable.Operators(operators => {
        operators.ForString(strFilter => strFilter.Clear().Contains("contains"));
    });
    filterable.Extra(false);
})

This still seems to be using IsEqual (i.e. it workd if you enter exactly what you're looking for)
0
Alexander Valchev
Telerik team
answered on 08 Feb 2013, 12:44 PM
Hi John,

This sounds like a know issue which is already fixed. May I ask which KendoUI version you use?
If it is an outdated one, please download and update to the Q3 SP release (2012.3.1315) or latest internal build. I tested this with the Service Pack and got it working as expected.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Steven
Top achievements
Rank 1
answered on 21 Jul 2013, 05:54 PM
I've added the additional syntax (MVC Wrappers) for example in case anyone else needs to see how to add multiple custom search fields. An added note for beginners, these will display in the order you list them and ForString() part means that the filter is applied to all string type columns.

.Filterable(f => f.Operators(o => o.ForString(fs => { fs.Clear().Contains("Contains"); fs.DoesNotContain("Does not contain"); fs.IsEqualTo("Equal to"); fs.IsNotEqualTo("Not equal to"); fs.StartsWith("Starts with"); fs.EndsWith("Ends with"); })))
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Dennis
Top achievements
Rank 1
maharajan
Top achievements
Rank 1
Jerry
Top achievements
Rank 1
Sean
Top achievements
Rank 1
Steven
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
John
Top achievements
Rank 1
Share this question
or