Completed
Last Updated: 09 Nov 2016 07:59 by ADMIN
ADMIN
Dimitar
Created on: 10 Mar 2016 11:45
Category: GridView
Type: Bug Report
1
FIX. RadGridView - when excel like filtering is used the distinct filter values are taken from the child templates as well.
To reproduce:
- Create load on demand hierarchy.
- Open the excel filter popup.
- The RowSourceNeeded event fires for  all rows.

Workaround:
public class MyGridHeaderCellElement : GridHeaderCellElement
{
  
    public MyGridHeaderCellElement(GridViewDataColumn col, GridRowElement row) : base(col, row)
    {
    }
  
    protected override Type ThemeEffectiveType
    {
        get { return typeof(GridHeaderCellElement); }
    }
  
    protected override IGridFilterPopup CreateFilterPopup()
    {
        this.GridControl.Tag = "FileterInitializing";
        return base.CreateFilterPopup();
    }
}
// in the main forms you cab skip the event code execution while the popup is initialized
private void RadGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
{
    this.radGridView1.Tag = null;
}
  
private void RadGridView1_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
  
    if (object.ReferenceEquals(e.CellType, typeof(GridHeaderCellElement)))
    {
        e.CellType = typeof(MyGridHeaderCellElement);
    }
}
void radGridView1_RowSourceNeeded(object sender, GridViewRowSourceNeededEventArgs e)
{
    if (radGridView1.Tag != null && radGridView1.Tag == "FileterInitializing")
    {
        return;
    }
    //other code
}
0 comments