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

How can I change the default filter for telerik mvc grid?

3 Answers 238 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.
Vinicius
Top achievements
Rank 1
Vinicius asked on 10 Sep 2010, 12:47 AM
How can I set the "Starts with" value to be the default filter for telerik asp.net mvc grid?

3 Answers, 1 is accepted

Sort by
0
Phuoc
Top achievements
Rank 1
answered on 26 Oct 2010, 04:49 AM
Here is the solution for u :                                    
        }
- First, add this onload event to your ajax grid :
  .ClientEvents(events => events.OnLoad("onload"))
- Then, add this javascirpt code block :
function onload() {
            $('#Grid .t-grid-filter').click();
            $('#Grid .t-filter-options').hide();
            $('#Grid .t-filter-options').find('select option[value="substringof"]')
                                        .attr('selected', true);
        }

-          First, add this onload event to your ajax grid :

      .ClientEvents(events => events.OnLoad("onload"))

-          Then, add this javascript code block :

function onload() {

            $('.t-grid-filter').click();

            $('.t-filter-options').hide();

            $('.t-filter-options').find('select option[value="startswith"]')

                                        .attr('selected', true);

        }

0
Vinicius
Top achievements
Rank 1
answered on 26 Oct 2010, 10:52 AM
Thank you so much!
0
Anvarbek
Top achievements
Rank 1
answered on 02 Dec 2011, 10:11 AM
or you can mess around with telerik.grid.min.js :)

seach for filterStringNe and make sure they are in this order:
filterStringNe: "Is not equal to", filterStringSubstringOf: "Contains", filterStringStartsWith: "Starts with", filterStringEndsWith: "Ends with", filterStringEq: "Is equal to",

that way "Contains" becomes the default item in the filter
Tags
Grid
Asked by
Vinicius
Top achievements
Rank 1
Answers by
Phuoc
Top achievements
Rank 1
Vinicius
Top achievements
Rank 1
Anvarbek
Top achievements
Rank 1
Share this question
or