Hi,
We are using your RadGridView in a lot of screens.
For the first time, we have to use the full text search (ctrl F) on a grouped gridview.
In our case (300 lines grouped in 6 groups), we are facing of some performance issue (which give the grid unusable for a final user: too slow).
Do you have a recommandation or best practices for the fulltext search ?
The problem disapear if we do that : control the lauch of the search after a timer of 300ms.
So, we change the RadGridView property IsSearchingDeferred="True" and add the following code in the code behind of our view (named ContractDocumentsView)
01.
...
02.
03.
// Constructor of ContractDocumentsView
04.
public
ContractDocumentsView(IServiceLocator serviceLocator)
05.
{
06.
InitializeComponent();
07.
08.
if
(DesignerProperties.GetIsInDesignMode(
this
))
09.
{
10.
return
;
11.
}
12.
13.
// UserActionDelay is DispatcherTimer timer of 300 ms that execute an Action
14.
this
.userActionDelay =
new
UserActionDelay(
this
.UpdateFilterOnSearchText);
15.
this
.documentsGridView.SearchPanelVisibilityChanged += (sender, args) =>
16.
{
17.
// We are keeping a var on the telerik GridViewSearchPanel, initialized once when SearchPanelVisibilityChanged
18.
if
(
this
.gridSearchPanel !=
null
)
19.
return
;
20.
21.
if
(args.NewVisibility == Visibility.Visible)
22.
{
23.
// ChildrenOfType is a method that search in the visual tree children...
24.
this
.gridSearchPanel =
this
.documentsGridView.ChildrenOfType<GridViewSearchPanel>().First();
25.
this
.gridSearchPanel.PreviewTextInput += SearchViewPanelOnPreviewTextInput;
26.
}
27.
};
28.
}
29.
30.
private
void
SearchViewPanelOnPreviewTextInput(
object
sender1, TextCompositionEventArgs textCompositionEventArgs)
31.
{
32.
this
.gridSearchPanel.PreviewTextInput -= SearchViewPanelOnPreviewTextInput;
33.
var searchBox =
this
.gridSearchPanel.ChildrenOfType<TextBox>().First();
34.
searchBox.TextChanged += SearchTextBox_TextChanged;
35.
}
36.
37.
private
void
SearchTextBox_TextChanged(
object
sender, TextChangedEventArgs e)
38.
{
39.
this
.searchText = ((TextBox)e.OriginalSource).Text;
40.
userActionDelay.DoAction();
41.
}
42.
43.
private
void
UpdateFilterOnSearchText()
44.
{
45.
var searchViewModel =
this
.gridSearchPanel.DataContext
as
Telerik.Windows.Controls.GridView.SearchPanel.SearchViewModel;
46.
if
(searchViewModel !=
null
)
47.
{
48.
searchViewModel.SearchText =
this
.searchText;
49.
}
50.
}
51.
52.
...