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

[Solved] How do I...reduce the number of selections for filtering?

5 Answers 174 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.
Paul Hoeffer
Top achievements
Rank 1
Paul Hoeffer asked on 04 Nov 2010, 07:37 PM
In my scenario, I'm doing all paging, sorting, and filtering in SQL as I have 60k+ rows of data and don't want to have to return all of them & sort, filter, etc. on the client.

I'm trying to understand how to limit the number of selections posed as filters.  For instance instead of offering:

'String': {
            'Is equal to': 'eq',
            'Is not equal to': 'ne',
            'Starts with': 'startswith',
            'Contains': 'substringof',
            'Ends with': 'endswith'
        },
        'Number': {
            'Is equal to': 'eq',
            'Is not equal to': 'ne',
            'Is less than': 'lt',
            'Is less than or equal to': 'le',
            'Is greater than': 'gt',
            'Is greater than or equal to': 'ge'
        },
        'Date': {
            'Is equal to': 'eq',
            'Is not equal to': 'ne',
            'Is before': 'lt',
            'Is before or equal to': 'le',
            'Is after': 'gt',
            'Is after or equal to': 'ge'
        }

I could limit it to:

'String': {
            'Is equal to': 'eq',
            'Starts with': 'startswith',
            'Contains': 'substringof',
        },
        'Number': {
            'Is equal to': 'eq',
            'Is not equal to': 'ne',
        },
        'Date': {
            'Is equal to': 'eq',
        }

Can I specify this on a particular grid?

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 05 Nov 2010, 08:42 AM
Hi Paul Hoeffer,

You can delete the operators which are not needed from the telerik.grid.filtering.js file and all grids will display the same options. Keep in mind though that you seem to be using an older version and in the current one the filtering UI is built in a different way - check the localization attribute in telerik.grid.js (but you need to updated to a more recent version).

All the best,

Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Hoeffer
Top achievements
Rank 1
answered on 08 Nov 2010, 06:23 PM
Thanks for the prompt reply.  So, this is global but doesn't allow me to customize this behavior for a specific grid or a specific column, which is what I'd desire.  I guess I could alter the js script itself to allow for this.  Would that be trivial, or hard to you think?
0
Atanas Korchev
Telerik team
answered on 09 Nov 2010, 08:22 AM
Hi Paul Hoeffer,

 If you upgrade to a more recent version you would be able to easily modify the filters per grid basis by deleting some entries from the grid.localization field:

function onLoad() {
      var grid = $(this).data('tGrid');
      delete grid.localization.filterStringNe;
      delete grid.localization.filterStringNe;
}

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Hoeffer
Top achievements
Rank 1
answered on 09 Nov 2010, 05:36 PM
Ta Atanas - I'll give it a go and let you know of the success :)
0
Bernhard
Top achievements
Rank 1
answered on 04 Mar 2013, 01:39 PM
Firstly, thank you for the answer Atanas, but what isn't clear to me, is where the suggested onLoad method should be defined. Could you elaborate on that please?

I think I can answer my own question now. Add the client event with the ClientEvents method on the grid:

@(Html.Telerik().Grid(Model)
    .Name("Grid")
    .Columns(...)
    ...
    .ClientEvents(e => e.OnLoad("onAccountGridLoad"))
)
Tags
Grid
Asked by
Paul Hoeffer
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Paul Hoeffer
Top achievements
Rank 1
Bernhard
Top achievements
Rank 1
Share this question
or