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

Move Search above Header

5 Answers 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mohsen
Top achievements
Rank 1
Mohsen asked on 28 Nov 2015, 01:38 PM
How can I move Search above columns header?

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 30 Nov 2015, 09:16 AM
Hi Mohsen,

Thank you for writing.

The following article explains how you can reorder the rows: Reordering System Rows.

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
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
0
Mohsen
Top achievements
Rank 1
answered on 01 Dec 2015, 09:30 AM
This is not I want. I want to move the Search Row above Header Row. How can I do this?
0
Accepted
Dimitar
Telerik team
answered on 02 Dec 2015, 11:23 AM
Hello Mohsen,

Thank you for writing back.

This is exactly what the article shows. If you have a default grid with a new and a search rows you can move the search row like this:
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    this.radGridView1.MasterView.SystemRows.Move(3, 0);
 
    this.radGridView1.GridViewElement.TableElement.InvalidateMeasure(true);
    this.radGridView1.GridViewElement.TableElement.UpdateLayout();
}

I hope this helps.

Regards,
Dimitar
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
0
Michael
Top achievements
Rank 1
answered on 19 Dec 2018, 09:57 PM

Hi,

I followed instructions in the article you suggested.  I was able to move the search row above header.  But, I also have a group row ("Drag a column here to group by column").  It seems not be part of the system rows.  Is it possible to move the seach row above it the group row?

 

Also, is it possible remove rows from search in column menu?  I mean, not just uncheck, remove completely?

Finally, is it possible for search for work like a filter?  I.e. when text is entered,only rows that match the criteria show on the list?

0
Dimitar
Telerik team
answered on 20 Dec 2018, 11:00 AM
Hi Michael,

The search row cannot be moved above the GroupPanel because the panel is not part of the container that contains the rows. 

I am not sure what you mena in the second question. Could you please elaborate?

It is possible to use the search as a filter, however, this needs to be manually inplemented. For example,e you can use hte TextcChanged event of the search text box and hide the extra rows. Here is the code:
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    var searchCell = radGridView1.TableElement.FindDescendant<GridSearchCellElement>();
    if (searchCell != null)
    {
        searchCell.SearchTextBox.TextBoxItem.TextChanged += TextBoxItem_TextChanged;
    }
    
}
 
private void TextBoxItem_TextChanged(object sender, EventArgs e)
{
    var textBox = sender as RadTextBoxItem;
 
 
    foreach (GridViewDataRowInfo row in radGridView1.Rows)
    {
        bool matchFound = false;
        foreach (GridViewCellInfo cell in row.Cells)
        {
            if (cell.Value != null)
            {
                string value = cell.Value.ToString().ToLower();
                if (value.Contains(textBox.Text.ToLower()))
                {
                    matchFound = true;
                }
            }
        }
        row.IsVisible = matchFound;
    }
    
}

I hope this will be useful.  

Regards,
Dimitar
Progress Telerik
Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Mohsen
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Mohsen
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or