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

Preserve list order after filter or search

2 Answers 30 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 24 Feb 2017, 11:58 AM

Good morning,

As you can see in the attached file I've used a RadGridView Control to show some sales.
With my program I can sell two items, then close partially the sales and then insert a new product e close the sales partially or definitively.

I've made this by create an object who refer to my model (my db model) and add to it a variable "Type" (who tells me wath kind of row is).
For the details (see the White row) I read my data db and set the "Type" at 0, for the Yellow and Green row I'm not read the data from db but with an internal foreach with variuous Group by I can know when a Row is a subtotal or a total and for these last 2 condition I set the type at 1 or 2, then with styles and datatrigger I color the lines.

This works, but if I use filter or the search control I lost the total and subtotal row.

 

How can I avoid it?

2 Answers, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 28 Feb 2017, 02:52 PM
Hello,

Unfortunately, the approach you've chosen will not work, because, as you've already seen, it contradicts with RadGridView's filtering, grouping and sorting mechanisms.

Rather than use this custom setup and keep track of the type of the rows, may I suggest using RadGridView's built-in grouping and aggregates features and introduce a new PurchaseId property, for example, to group the different purchases.

To better demonstrate what I have in mind, I'm attaching a sample project with the implementation.

You can further modify and style this to suit your exact requirements.

Do let me know if such an approach would work for you. I'm looking forward to your reply.

Regards,
Dilyan Traykov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Marco
Top achievements
Rank 1
answered on 01 Mar 2017, 11:44 AM

Thanks a lot

It was what I needed

Tags
GridView
Asked by
Marco
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Marco
Top achievements
Rank 1
Share this question
or