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

[Solved] Have another default telerik filter

7 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Julien
Top achievements
Rank 1
Julien asked on 10 Jul 2012, 07:15 AM
Hi

In an asp.net mvc telerik grid, the default filter is "is equal to", is it possible to have instead by default another option? In my case I would like to have by default "contains", because it's the one we use 99% of time, and it's an operation we do often.

Thank you

7 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 11 Jul 2012, 09:36 AM
Hello Julien,

You could easily achieve this with the following function hooked to the OnLoad event of the Grid.
function onGridLoad(){
        $('.t-grid-filter').one('click', function () {
            var container = $(this).data().filter;
            $('.t-filter-operator',container).val('substringof');
        });
}
   


I hope this helps.



Regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Julien
Top achievements
Rank 1
answered on 11 Jul 2012, 09:44 AM
Exactly what I needed, thank you very much
0
Julien
Top achievements
Rank 1
answered on 20 Feb 2013, 10:45 AM
I just remarked a problem with this:

We have a non-ajax binding. 

So if we do the following:
1. Open the filter by clicking on the filter icon
2. Change the selected filter type to another one
3. Type a value for the filter
4. Apply
5. -- The page reload --, the filter is correctly made
6. Click again on the filter icon
7. It's not the current filter type which is displayed, but the default one we set with the JS code

Any idea about how to make a workaround for this?
0
Julien
Top achievements
Rank 1
answered on 18 Mar 2013, 04:08 PM
It makes one month that we didn't get any answers, can you please respond?
0
Beat
Top achievements
Rank 1
answered on 18 Mar 2013, 05:09 PM
same problem for me
0
Petur Subev
Telerik team
answered on 21 Mar 2013, 10:56 AM
Hello,

The shared work-around is applicable only for Ajax bound Grid. When using server binding the whole page is reloaded and the selected filter will be changed by the code  I shared. I am sorry but there is no simple work-around  for the server binding scenario.

Kind Regards,
Petur Subev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
0
Yves
Top achievements
Rank 1
answered on 14 May 2013, 08:46 AM
This code works for me:

function onGridLoad() {
    $('.t-grid-filter').one('click', function () {
        var container = $(this).data().filter;
        $('.t-filter-operator', container).each(function () {
            var value = $(this).next().val();
            if (value === "") {
                $(this).val('substringof');
            }
        });
    });
}

Its sort of a hack but it does the job :)
Tags
Grid
Asked by
Julien
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Julien
Top achievements
Rank 1
Beat
Top achievements
Rank 1
Yves
Top achievements
Rank 1
Share this question
or