Completed
Last Updated: 19 Nov 2019 12:05 by ADMIN
Release 2019.3.1119 (R3 2019 minor release)
Safan
Created on: 18 Oct 2019 15:05
Category: DataGrid
Type: Bug Report
1
DataGrid Filter Issue After Navigation

Refer to the attached reproducible.

1. Run app and apply a filter: "Contains 0"

2. Notice #40 is in the correct location, between #30 and #50

3. Press the button on the bottom of the page to go BlankPage and then navigate back.

4. Observe #40 is now at the end of the rows even though the filter is clearly applied.

Look in MainPageViewModel.cs lines 42 to 49. When the navigation back occurs, this code is executed.  I can reproduce the problem with both Replace and Add+Remove operations.

public override void OnNavigatedTo(INavigationParameters parameters)
{
    base.OnNavigatedTo(parameters);

    if (!parameters.ContainsKey("from"))
    {
        var items = new ObservableCollection<MyModel>();
        for (var i = 1; i <= 100; i++)
            items.Add(new MyModel { Number = i.ToString() });
        Items = items;
    }
    else
    {
        var item = Items[39];

        // Bug Test #1 - using ObservableCollection Reset
        Items[39] = item;

        // Bug Test #2 - using ObservableCollection Remove & Add
        //Items.RemoveAt(39);
        //Items.Insert(39, item);
    }
}

Attached Files:
0 comments