TableSearchRow - Collection of results

4 posts, 0 answers
  1. Andreas Haeusler
    Andreas Haeusler avatar
    25 posts
    Member since:
    Nov 2009

    Posted 20 Oct 2015 Link to this post

    Hello,

     

    is there any way to access a collection of the cells/rows that match the search criteria?

    I'm trying to implement a combined search/filter - function -- using the SearchProgressChangedEvent to hide all rows that do not match the search criteria.

     

     

    Kind regards,

    Andreas

  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 21 Oct 2015 Link to this post

    Hello Andreas,

    Thank you for writing.

    Here is a sample code snippet demonstrating how to get the search results in RadGridView:
    public Form1()
    {
        InitializeComponent();
        this.radGridView1.AllowSearchRow = true;
        this.radGridView1.MasterView.TableSearchRow.InitialSearchResultsTreshold = 0;
        this.radGridView1.MasterView.TableSearchRow.SearchProgressChanged += TableSearchRow_SearchProgressChanged;
    }
     
    private void TableSearchRow_SearchProgressChanged(object sender, Telerik.WinControls.UI.SearchProgressChangedEventArgs e)
    {
        if (e.SearchFinished == false && e.SearchCriteria != null && e.SearchCriteria != string.Empty)
        {
            Console.WriteLine("Search results: " + e.Cells.Count);
            foreach (GridSearchResultCellInfo c in e.Cells)
            {
                Console.WriteLine(c.RowInfo.Cells[c.ColumnInfo.Name].Value);
            }
        }
    }

    You can find additional information in the Search Row help article.

    As to the filtering case, you can refer to our Demo application >> GridView >> Filtering >> Custom filtering example which uses the custom filtering functionality to hide the rows that do not match the criterion.

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Andreas Haeusler
    Andreas Haeusler avatar
    25 posts
    Member since:
    Nov 2009

    Posted 21 Oct 2015 in reply to Dess Link to this post

    Hello Dess,

     

    thank you for your feedback -- that is similar to how i approached the issue... only difference: i waited for e.SearchFinished == true.

    It's not very intuitive that SearchProgressChangedEventArgs.Cells is NULL once the search is over.

     

    I will modify my code accordingly.

     

    Thanks again,

    Andreas

  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 21 Oct 2015 Link to this post

    Hello Andreas,

    Thank you for writing back.

    Indeed, it is not very intuitive and it should be improved. That is why I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

    I have also updated your Telerik points.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top