This is a migrated thread and some comments may be shown as answers.
Saving/Loading Search Panel SearchText
1 Answer 3 Views
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 27 Jan 2021, 02:47 AM

I have create a project where the user creates different filter buttons which, when clicked, updates the SearchText in the SearchPanel.  And then the user can persist these saved buttons and reload at startup.  Everything is working great except one thing!    If the user sets SearchText and the grid then gets new data, the SearchText goes blank.  Is there a way to persist the SearchText regardless of the underlining data changing?

I am actually using an external Textbox to set the SearchText and followed some of your examples of binding to the SeachText.

 

private void OnLoaded(object sender, RoutedEventArgs e)
        {
            this.GridStats.ShowSearchPanel = false;
            _vmSearchPanel = this.GridStats.ChildrenOfType<GridViewSearchPanel>().FirstOrDefault();
            this.txtFilter.SetBinding(TextBox.TextProperty, new Binding("SearchText") { Source = _vmSearchPanel.DataContext, Mode = BindingMode.TwoWay });
        }

 

On a side note, it would be nice to be able to easily save/load SearchText because it makes a quicker way version saving all the Filter criteria on the Grid or using a RadFilter if you just want one textbox.

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 29 Jan 2021, 01:52 PM

Hello Jason,

There is no built-in mechanism for persisting the search text. The text is cleared when the gridview data is reset. To achieve your requirement, you can save the text value just before the data reset and then restore it via the SearchText property of the GridViewSearchPanel's DataContext.

About your suggestion for easily save/load SearchText, can you describe it with a bit more details because I am not sure that I fully understand the requirement here?

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Asked by
Jason
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or