I use a RadGridView with the style shown below (Important one is FilterRow)
I have limited the amount of filter options based on the contenttype with the class shown below
step 1: when the window loads the gridview displays data (situation: only available filter is contains)
step 2:
- I enter some existing value in the filterrow
- I hit the enter key
- the grid filters the content (works ok)
step 3:
- I enter a value that does not exist
- I hit the enter key
- the grid filters the content (no results = works ok)
step 4:
- I remove the value
- I hit enter
- the grid shows all my data (=ok)
Now when I do the same thing as above, and I do not use the enter key, but I use the mouse, it behaves weird
step 1: when the window loads the gridview displays data (situation: only available filter is contains)
step 2:
- I enter some existing value in the filterrow
- I click on the the dropdown menu and it expands. 2 options are visible (Clear Filter, Contains (highlighted))
I didn't select anything yet but the grid already filters my data (=weird)
- when I click the highlighted "contains" menuoption it does not result in the dropdown menu going away (=weird)
step 3:
- I enter a value that does not exist
- I click on the dropdown menu and it expands. (same weirdness as in step 2)
- I click on the dropdown menu and select "clear filter"
the non-existing value gets removed from the textbox (=ok)
the grid does not show any data (= very weird, I would expect all my data to show now)
In order to get content back in my grid I seem to need to enter a value that exists and click the filter drop down again
(does not always seem to work though, so Im unsure what the deal is here).
from a user experience this is the main problem I'm facing right now
we use version 2013.1.403.1050 of telerik.windows.controls.gridview
public class MyOwnCustomGridView : RadGridView
{
public MyOwnCustomGridView
()
{
FilterOperatorsLoading += OnFilterOperatorsLoading;
FieldFilterEditorCreated += OnFieldFilterEditorCreated;
Filtering += OnFiltering;
Filtered += OnFiltered;
}
private void OnFiltered(object sender, GridViewFilteredEventArgs e)
{
}
private void OnFiltering(object sender, GridViewFilteringEventArgs e)
{
}
private static void OnFilterOperatorsLoading(object sender, FilterOperatorsLoadingEventArgs e)
{
var baseColumn = e.Column as GridViewBoundColumnBase;
if (baseColumn == null)
{
return;
}
if (baseColumn.DataType == typeof(string))
{
SetDefaultFilterOperator(e, FilterOperator.Contains);
}
else if (baseColumn.DataType == typeof(int) ||
baseColumn.DataType == typeof(int?) ||
baseColumn.DataType == typeof(PlanningTemplateType) ||
baseColumn.DataType == typeof(CountryCode) ||
baseColumn.DataType == typeof(TunerStatus))
{
SetDefaultFilterOperator(e, FilterOperator.IsEqualTo);
}
}
private void FilterChanged(object sender, EventArgs e)
{
}
private static void SetDefaultFilterOperator(FilterOperatorsLoadingEventArgs e, FilterOperator defaultFilterOperator)
{
e.AvailableOperators.RemoveAll(filterOperator => filterOperator != defaultFilterOperator);
e.DefaultOperator1 = defaultFilterOperator;
e.DefaultOperator2 = defaultFilterOperator;
}
private static void OnFieldFilterEditorCreated(object sender, EditorCreatedEventArgs e)
{
var stringFilterEditor = e.Editor as StringFilterEditor;
if (stringFilterEditor != null)
{
stringFilterEditor.MatchCaseVisibility = System.Windows.Visibility.Collapsed;
}
}
}
I have limited the amount of filter options based on the contenttype with the class shown below
step 1: when the window loads the gridview displays data (situation: only available filter is contains)
step 2:
- I enter some existing value in the filterrow
- I hit the enter key
- the grid filters the content (works ok)
step 3:
- I enter a value that does not exist
- I hit the enter key
- the grid filters the content (no results = works ok)
step 4:
- I remove the value
- I hit enter
- the grid shows all my data (=ok)
Now when I do the same thing as above, and I do not use the enter key, but I use the mouse, it behaves weird
step 1: when the window loads the gridview displays data (situation: only available filter is contains)
step 2:
- I enter some existing value in the filterrow
- I click on the the dropdown menu and it expands. 2 options are visible (Clear Filter, Contains (highlighted))
I didn't select anything yet but the grid already filters my data (=weird)
- when I click the highlighted "contains" menuoption it does not result in the dropdown menu going away (=weird)
step 3:
- I enter a value that does not exist
- I click on the dropdown menu and it expands. (same weirdness as in step 2)
- I click on the dropdown menu and select "clear filter"
the non-existing value gets removed from the textbox (=ok)
the grid does not show any data (= very weird, I would expect all my data to show now)
In order to get content back in my grid I seem to need to enter a value that exists and click the filter drop down again
(does not always seem to work though, so Im unsure what the deal is here).
from a user experience this is the main problem I'm facing right now
we use version 2013.1.403.1050 of telerik.windows.controls.gridview
<
Style
x:Key
=
"RadGridViewDefault"
TargetType
=
"telerik:RadGridView"
><
br
>
<
Setter
Property
=
"IsReadOnly"
Value
=
"True"
/><
br
>
<
Setter
Property
=
"IsFilteringAllowed"
Value
=
"True"
/><
br
>
<
Setter
Property
=
"AutoGenerateColumns"
Value
=
"False"
/><
br
>
<
Setter
Property
=
"ShowColumnHeaders"
Value
=
"True"
/><
br
>
<
Setter
Property
=
"ShowColumnFooters"
Value
=
"False"
/><
br
>
<
Setter
Property
=
"ShowGroupPanel"
Value
=
"False"
/><
br
>
<
Setter
Property
=
"SelectionUnit"
Value
=
"FullRow"
/><
br
>
<
Setter
Property
=
"FilteringMode"
Value
=
"FilterRow"
/><
br
>
<
Setter
Property
=
"CanUserDeleteRows"
Value
=
"False"
/><
br
>
<
Setter
Property
=
"CanUserInsertRows"
Value
=
"False"
/><
br
>
<
Setter
Property
=
"BorderThickness"
Value
=
"1"
/><
br
>
<
Setter
Property
=
"Margin"
Value
=
"0"
/><
br
>
<
Setter
Property
=
"RowIndicatorVisibility"
Value
=
"Collapsed"
/><
br
>
<
Setter
Property
=
"CanUserFreezeColumns"
Value
=
"False"
/><
br
>
<
Setter
Property
=
"ScrollViewer.HorizontalScrollBarVisibility"
Value
=
"Hidden"
/><
br
>
<
Setter
Property
=
"FontSize"
Value
=
"14.667"
/><
br
>
<
Setter
Property
=
"FontFamily"
Value
=
"Calibri"
/><
br
>
<
Setter
Property
=
"Cursor"
Value
=
"Hand"
/><
br
>
</
Style
>
public class MyOwnCustomGridView : RadGridView
{
public MyOwnCustomGridView
()
{
FilterOperatorsLoading += OnFilterOperatorsLoading;
FieldFilterEditorCreated += OnFieldFilterEditorCreated;
Filtering += OnFiltering;
Filtered += OnFiltered;
}
private void OnFiltered(object sender, GridViewFilteredEventArgs e)
{
}
private void OnFiltering(object sender, GridViewFilteringEventArgs e)
{
}
private static void OnFilterOperatorsLoading(object sender, FilterOperatorsLoadingEventArgs e)
{
var baseColumn = e.Column as GridViewBoundColumnBase;
if (baseColumn == null)
{
return;
}
if (baseColumn.DataType == typeof(string))
{
SetDefaultFilterOperator(e, FilterOperator.Contains);
}
else if (baseColumn.DataType == typeof(int) ||
baseColumn.DataType == typeof(int?) ||
baseColumn.DataType == typeof(PlanningTemplateType) ||
baseColumn.DataType == typeof(CountryCode) ||
baseColumn.DataType == typeof(TunerStatus))
{
SetDefaultFilterOperator(e, FilterOperator.IsEqualTo);
}
}
private void FilterChanged(object sender, EventArgs e)
{
}
private static void SetDefaultFilterOperator(FilterOperatorsLoadingEventArgs e, FilterOperator defaultFilterOperator)
{
e.AvailableOperators.RemoveAll(filterOperator => filterOperator != defaultFilterOperator);
e.DefaultOperator1 = defaultFilterOperator;
e.DefaultOperator2 = defaultFilterOperator;
}
private static void OnFieldFilterEditorCreated(object sender, EditorCreatedEventArgs e)
{
var stringFilterEditor = e.Editor as StringFilterEditor;
if (stringFilterEditor != null)
{
stringFilterEditor.MatchCaseVisibility = System.Windows.Visibility.Collapsed;
}
}
}