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

Sorting problems with RadGridView using PagedCollectionView ItemSource

7 Answers 209 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 13 Jan 2012, 07:15 AM
I have encountered a problem with using a System.Windows.Data.PagedCollectionView as the ItemSource of a RadDataGrid.

Summary of issue:
When a column in the grid is sorted descending and another column (not sorted) is then edited, the edited row moves to an unexpected index. This does not occur with the Microsoft DataGrid.

Steps to reproduce:
1. Have a RadDataGrid's ItemSource bound to an instance of PagedCollectionView populated with some data.
2. Sort a column descending via the RadDataGrid column header.
3. Edit the cell of another column (not the column that is sorted).
4. End the cell/row edit by press ENTER or clicking on another row.

Result: The row you just edited will move somewhere else when it shouldn't.

How I am defining the grid in XAML:
<telerik:RadGridView ItemsSource="{Binding}" />

How I am initialising the PagedCollectionView:
public MainPage()
{
    InitializeComponent();
 
    // Initialize test data. Give SortableField some unsorted values.
    SomePoco[] data = new SomePoco[]
    {
        new SomePoco() { SortableField = "D" },
        new SomePoco() { SortableField = "C" },
        new SomePoco() { SortableField = "B" },
        new SomePoco() { SortableField = "A" },
        new SomePoco() { SortableField = "H" },
        new SomePoco() { SortableField = "G" },
        new SomePoco() { SortableField = "F" },
        new SomePoco() { SortableField = "E" },
        new SomePoco() { SortableField = "L" },
        new SomePoco() { SortableField = "K" },
        new SomePoco() { SortableField = "J" },
        new SomePoco() { SortableField = "I" },
        new SomePoco() { SortableField = "P" },
        new SomePoco() { SortableField = "O" },
        new SomePoco() { SortableField = "N" },
        new SomePoco() { SortableField = "M" },
        new SomePoco() { SortableField = "T" },
        new SomePoco() { SortableField = "S" },
        new SomePoco() { SortableField = "R" },
        new SomePoco() { SortableField = "Q" },
        new SomePoco() { SortableField = "X" },
        new SomePoco() { SortableField = "W" },
        new SomePoco() { SortableField = "V" },
        new SomePoco() { SortableField = "U" },
        new SomePoco() { SortableField = "Z" },
        new SomePoco() { SortableField = "Y" }
    };
 
    this.DataContext = new PagedCollectionView(data);
}
(NOTE: SomePoco has SortableField + 10 other int fields)

I have also attached screen shots of the issue occurring.

Environment Details:
Telerik Controls Version: 2011.3.1220.1050
Silverlight Version: 5.0.61118.0
Browser: IE9 version 9.0.8112.16421
OS: Windows 7 Enterprise (Version 6.1 Build 7600)

Thank you for your time.

7 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 17 Jan 2012, 04:53 PM
Hello,

Could you please try your scenario with our latest internal build (2011.3.1316) and let me know how it works on your end?

All the best,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 1
answered on 18 Jan 2012, 03:04 AM
Hi,

Thank you very much for your reply.

I have retested with the latest internal build (2011.3.1316) and that particular bug appears to be fixed, thank you!

I have discovered another anomaly however; if I sort by a column that contains equal values for each row i.e. zero and then alter a row in an unsorted column the row moves unexpectedly (similar to how it was in the previous issue). I'm guessing this is something to do with a full re-sort or data load occurring as a result of the edit ending? This doesn't occur if I am binding to an IEnumerable only PagedCollectionView.

Note, in this case it doesn't matter what direction the column is sorted, ascending or descending both exhibit the issue. I am using the same code as above with the latest internal build (2011.3.1316).

I have attached screen captures of this use case in action.

Thanks again for looking into these issues.

Adam
0
Nedyalko Nikolov
Telerik team
answered on 18 Jan 2012, 03:01 PM
Hi,

This issue will be fixed with the next internal build (we've spotted it while investigating the previous issue but we have not enough time to fix it). Unfortunately we cannot fix similar problem in a grouped scenario. The problem comes from the fact that RadGridView listens for a collection changed event but in grouped scenario indexes within NotifyCollectionChangedEventArgs are incorrect (they are correct but for flat scenario). If you need to use grouping I strongly recommend you to use our QueryableCollectionView instead of PagedCollectionView.

Greetings,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 1
answered on 19 Jan 2012, 12:04 AM
Thank you for the fast reply.

Please let me know when the next internal build containing the fix is available so I can test.

Also, thanks for the heads up around grouping, I will investigate whether or not this is a problem for us when I get the next build.

If we need to eventually use QueryableCollectionView instead we know of some problems with it that prevent us from using it. We'd probably have to get those issues fixed.

That said; our preference is to use Microsoft or internal libraries where possible in our View Models so we will see how far we can get with PagedCollectionView first.

Thanks again!
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 23 Jan 2012, 04:21 PM
Hello,

Later today the internal build will be available for download.
 
All the best,
Nedyalko Nikolov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Adam
Top achievements
Rank 1
answered on 24 Jan 2012, 02:40 AM
Hi,

I have retested with the latest internal build (2011.3.1323) the bug is fixed, thank you! We considered the additional grouping issue and decided it is an edge case we don't need to handle. I have marked your latest response as the answer.

Also, am I correct in understanding my account is eligible for additional Telerik points for assisting with the resolution of this bug?

Thank you again for your time.

Adam
0
Vlad
Telerik team
answered on 24 Jan 2012, 08:02 AM
Hi,

 We've added 2000 Telerik points to your account.

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Adam
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Adam
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or