Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
Changing column filter with active row not visible crashes
posted

If you have the column currently filtered to a value using the dropdown menu(small filter button) on the column header, and you try to change the filter on that column to another value, and the active row is currently scrolled off the screen, then an argument out of range exception will be thrown. If in debug build then the Debug.Assert(index >= 0) on line 2168 of ViewableRecordCollection.cs fails because index is -1.

The following code demonstrates the error,


in xaml:
<igGrid:XamDataGrid x:Name="DataGrid"
                            Theme="Office2k7Silver"
                            AutoFit="False"
                            IsUndoEnabled="True"
                            RecordContainerGenerationMode="Recycle"/>
                          
                          
                          
public class RowData
{
    public string Name { get; set; }
    public string Value { get; set; }
}

public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();

        FieldLayout layout = new FieldLayout();
        layout.IsDefault = true;          
        layout.Settings.AutoGenerateFields = false;
        layout.Settings.HeaderPrefixAreaDisplayMode = HeaderPrefixAreaDisplayMode.None;
        layout.Settings.HighlightAlternateRecords = true;
        layout.Settings.FilterUIType = FilterUIType.LabelIcons;
        layout.Settings.FilterAction = RecordFilterAction.Hide;          
        layout.Settings.SelectionTypeCell = SelectionType.Extended;  

        Field field1 = new Field("Name");
        field1.Settings.AllowRecordFiltering = true;
        layout.Fields.Add(field1);

        Field field2 = new Field("Value");
        field2.Settings.AllowRecordFiltering = true;
        layout.Fields.Add(field2);

        DataGrid.FieldLayouts.Clear();
        DataGrid.FieldLayouts.Add(layout);

        List<RowData> rows = new List<RowData>();
        for (int i = 0; i < 39; i++)
        {
            rows.Add(new RowData { Name = i.ToString(), Value = ((i % 2 == 0) ? "A" : "B") });
        }

        DataGrid.DataSource = rows;
    }          
}    


Steps:

-filter the second column to A using the filter button dropdown,
-select the first row
-scroll down so you can't see the active row
-change the filter on the second column to B
-it crashes


I'm using the 2049 service release and created a support case CAS-39916-Z1KZRP

  • 69686
    posted

    Hello,

    I was also able to reproduce this. I am going to take over the case and submit it in our system. You will be notified when the service release for it is out.