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

How to Filter prefixes

13 Answers 216 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ehsan
Top achievements
Rank 1
ehsan asked on 18 Oct 2010, 08:04 AM
Hi
I'm using version 2010 Q2. In this version, we have filter prefixes in the filter row. But I like to remove them (Just like previous version).
How can I do that?

13 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 18 Oct 2010, 09:09 AM
Hi, 

I'm not quite sure what you mean by Filter Prefixes. I presume that you mean you want to clear the current Filter Descriptors? 
Me.RadGridView.FilterDescriptors.Clear()
Or, go to the Properties window of the Grid, and open the Filter Descriptors property and remove each one. 
This will put back the filter operand for each column to the default type for that column. 

There is a link here on setting filters programatically and a section in the demos that are installed with the controls that show filtering examples. 

Let me know if this isn't what you meant. 
Richard
0
ehsan
Top achievements
Rank 1
answered on 18 Oct 2010, 09:21 AM
Hi Richard

No, I don't want to clear filter descriptors. Are u using 2010 Q2? In this version there is a little change in filter row.
In each filter cell (top most row), there is a prefix regarding what type the current filter is : e.g. Contains: ... or IsEqualTo: ......
and we must fill the ..... field. All i want is to hide these prefixes; (contains, IsEqualTo, etc )
Did i make it clear?
0
Richard Slade
Top achievements
Rank 2
answered on 18 Oct 2010, 09:32 AM
Hi, 
There may be another way but I think you would need to localize a RadGridView to provide your own text (or in your case remove the text)
See this link on help with localization of the RadGridView. 

Hope this helps
Richard

EDIT: Yes, I'm using the latest version too
0
ehsan
Top achievements
Rank 1
answered on 18 Oct 2010, 09:39 AM
I'm currently localize my gridview in persian. All localized strings are fine except for these filter operators in  filter row. 
localization works fine even for filter context menu, but it fails for filter row. :(
So, i wanted to remove those prefixes
0
Richard Slade
Top achievements
Rank 2
answered on 18 Oct 2010, 09:49 AM
Hi, 

It is in the localization. You just need to get the right string. 
case RadGridStringId.FilterOperatorContains

Richard

EDIT: All of the ones that you need in the localization start with "FilterOperator"
hope that helps
0
Richard Slade
Top achievements
Rank 2
answered on 18 Oct 2010, 10:26 AM
Hi, 

This is all the localization strings that the grid implements. 
case RadGridStringId.FilterFunctionBetween:
case RadGridStringId.FilterFunctionContains:
case RadGridStringId.FilterFunctionDoesNotContain:
case RadGridStringId.FilterFunctionEndsWith:
case RadGridStringId.FilterFunctionEqualTo:
case RadGridStringId.FilterFunctionGreaterThan:
case RadGridStringId.FilterFunctionGreaterThanOrEqualTo:
case RadGridStringId.FilterFunctionIsEmpty:
case RadGridStringId.FilterFunctionIsNull:
case RadGridStringId.FilterFunctionLessThan:
case RadGridStringId.FilterFunctionLessThanOrEqualTo:
case RadGridStringId.FilterFunctionNoFilter:
case RadGridStringId.FilterFunctionNotBetween:
case RadGridStringId.FilterFunctionNotEqualTo:
case RadGridStringId.FilterFunctionNotIsEmpty:
case RadGridStringId.FilterFunctionNotIsNull:
case RadGridStringId.FilterFunctionStartsWith:
case RadGridStringId.FilterFunctionCustom:
case RadGridStringId.FilterOperatorBetween:
case RadGridStringId.FilterOperatorContains:
case RadGridStringId.FilterOperatorDoesNotContain:
case RadGridStringId.FilterOperatorEndsWith:
case RadGridStringId.FilterOperatorEqualTo:
case RadGridStringId.FilterOperatorGreaterThan:
case RadGridStringId.FilterOperatorGreaterThanOrEqualTo:
case RadGridStringId.FilterOperatorIsEmpty:
case RadGridStringId.FilterOperatorIsNull:
case RadGridStringId.FilterOperatorLessThan:
case RadGridStringId.FilterOperatorLessThanOrEqualTo:
case RadGridStringId.FilterOperatorNoFilter:
case RadGridStringId.FilterOperatorNotBetween:
case RadGridStringId.FilterOperatorNotEqualTo:
case RadGridStringId.FilterOperatorNotIsEmpty:
case RadGridStringId.FilterOperatorNotIsNull:
case RadGridStringId.FilterOperatorStartsWith:
case RadGridStringId.FilterOperatorIsLike:
case RadGridStringId.FilterOperatorNotIsLike:
case RadGridStringId.FilterOperatorIsContainedIn:
case RadGridStringId.FilterOperatorNotIsContainedIn:
case RadGridStringId.FilterOperatorCustom:
case RadGridStringId.CustomFilterMenuItem:
case RadGridStringId.CustomFilterDialogCaption:
case RadGridStringId.CustomFilterDialogLabel:
case RadGridStringId.CustomFilterDialogRbAnd:
case RadGridStringId.CustomFilterDialogRbOr:
case RadGridStringId.CustomFilterDialogBtnOk:
case RadGridStringId.CustomFilterDialogBtnCancel:
case RadGridStringId.CustomFilterDialogCheckBoxNot:
case RadGridStringId.DeleteRowMenuItem:
case RadGridStringId.SortAscendingMenuItem:
case RadGridStringId.SortDescendingMenuItem:
case RadGridStringId.ClearSortingMenuItem:
case RadGridStringId.ConditionalFormattingMenuItem:
case RadGridStringId.GroupByThisColumnMenuItem:
case RadGridStringId.UngroupThisColumn:
case RadGridStringId.ColumnChooserMenuItem:
case RadGridStringId.HideMenuItem:
case RadGridStringId.UnpinMenuItem:
case RadGridStringId.PinMenuItem:
case RadGridStringId.PinAtLeftMenuItem:
case RadGridStringId.PinAtRightMenuItem:
case RadGridStringId.BestFitMenuItem:
case RadGridStringId.PasteMenuItem:
case RadGridStringId.EditMenuItem:
case RadGridStringId.ClearValueMenuItem:
case RadGridStringId.CopyMenuItem:
case RadGridStringId.AddNewRowString:
case RadGridStringId.ConditionalFormattingCaption:
case RadGridStringId.ConditionalFormattingLblColumn:
case RadGridStringId.ConditionalFormattingLblName:
case RadGridStringId.ConditionalFormattingLblType:
case RadGridStringId.ConditionalFormattingLblValue1:
case RadGridStringId.ConditionalFormattingLblValue2:
case RadGridStringId.ConditionalFormattingGrpConditions:
case RadGridStringId.ConditionalFormattingGrpProperties:
case RadGridStringId.ConditionalFormattingChkApplyToRow:
case RadGridStringId.ConditionalFormattingBtnAdd:
case RadGridStringId.ConditionalFormattingBtnRemove:
case RadGridStringId.ConditionalFormattingBtnOK:
case RadGridStringId.ConditionalFormattingBtnCancel:
case RadGridStringId.ConditionalFormattingBtnApply:
case RadGridStringId.ConditionalFormattingRuleAppliesOn:
case RadGridStringId.ConditionalFormattingChooseOne:
case RadGridStringId.ConditionalFormattingEqualsTo:
case RadGridStringId.ConditionalFormattingIsNotEqualTo:
case RadGridStringId.ConditionalFormattingStartsWith:
case RadGridStringId.ConditionalFormattingEndsWith:
case RadGridStringId.ConditionalFormattingContains:
case RadGridStringId.ConditionalFormattingDoesNotContain:
case RadGridStringId.ConditionalFormattingIsGreaterThan:
case RadGridStringId.ConditionalFormattingIsGreaterThanOrEqual:
case RadGridStringId.ConditionalFormattingIsLessThan:
case RadGridStringId.ConditionalFormattingIsLessThanOrEqual:
case RadGridStringId.ConditionalFormattingIsBetween:
case RadGridStringId.ConditionalFormattingIsNotBetween:
case RadGridStringId.ColumnChooserFormCaption:
case RadGridStringId.ColumnChooserFormMessage:
case RadGridStringId.GroupingPanelDefaultMessage:
case RadGridStringId.GroupingPanelHeader:
case RadGridStringId.NoDataText:
Richard
0
ehsan
Top achievements
Rank 1
answered on 18 Oct 2010, 10:36 AM
I dont have FilterOperator... strings :(
what version do u have?
mine is 2010.2.10.726 and there is no filteroperator localization :((
0
Richard Slade
Top achievements
Rank 2
answered on 18 Oct 2010, 10:40 AM
Hi, 

I'm using the latest version which is 2010 Q2 914
If you upgrade to this version then you will get the new strings. 

There are also quite a few fixes and enhancements in this version too. 
Hope that helps
Richard
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 18 Oct 2010, 09:12 PM
Hello guys,

An easier way to do this, to remove those filter strings (if i understood correctly), in my point of view is to register for the CellFormatting event, and to set the visibility of the FilterOperatorText primitive to collapsed, like so:
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    var filterCell = e.CellElement as GridFilterCellElement;
    if (filterCell != null)
    {
        var gridFilterElement = e.CellElement as GridFilterCellElement;
        gridFilterElement.FilterOperatorText.Visibility = ElementVisibility.Collapsed;
    }
}

This will hide those texts.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Richard Slade
Top achievements
Rank 2
answered on 18 Oct 2010, 11:25 PM
Hi Emanuel,

I agree this is a neat workaround, but for performance, I'd advise updating and using the localization method. Good if upgrading is not a possibility though.

Regards,
Richard
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Oct 2010, 09:41 AM
Hello Richard,

if you want to show all the strings to the user, then yes, your way with the localization strings, is the cleanest way.
But if you just want to hide those, then (in my opinion) it's better to just collapse those text primitives, then the Grid Localization won't be queried for values anymore because those primitives are not visible so they will not be loaded, or at least that should be the theory.

Best Regards,
Emanuel Varga
0
Richard Slade
Top achievements
Rank 2
answered on 19 Oct 2010, 09:48 AM
Hi Emanuel, 

I don't disagree that this is a good way to do it. I certainly hadn't thought of that myself, and for a non-upgrade solution I think it's excellent. But I have to disagree that it's the cleanest way. With so much that could be done in the CellFormatting event, I believe it would be better to abstract away any changes to the text into the localization section and also shouldn't need to change in future upgrades. 
We may have to agree to disagree though. :o) 

Speak soon
All the best
Richard
0
Emanuel Varga
Top achievements
Rank 1
answered on 19 Oct 2010, 09:51 AM
Sorry, i think i formulated the first sentence wrong, you're suggestion with the localization strings is the clean way of doing things, but if you want some specific things than the one with collapsing will do the trick and it will offer more space for the filter text entry.

*Update, I've edited my previous post also

Best Regards,
Emanuel Varga
Tags
GridView
Asked by
ehsan
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
ehsan
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Share this question
or