We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get sorted items from SfDataGrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

132572 Sep 9,2017 04:19 AM UTC Sep 11,2017 05:20 PM UTC WPF 1
loading
Tags: SfDataGrid
Maltsev
Asked On September 9, 2017 04:19 AM UTC

Hello, dear developers!
I wanna ask, how can I get sorted and/or grouped items from SfDataGrid after user's sorting?
In other words, can I get items from grid in it's current visible order?

Thanks for advance.

Muthukumar Kalyanasundaram [Syncfusion]
Replied On September 11, 2017 05:20 PM UTC

Hi Maltsev, 

Thank you for contacting Syncfusion support. 

We have checked your query. Pease find the response from below table. 


Query 1: 
How can I get sorted and/or grouped items from SfDataGrid after user's sorting? 

You can able to get the records of the group by passing the appropriate index to DisplayElements of View.TopLevelGroup as like the below code snippet,  

Code Snippet: 
 
// to get the toplevel groups items 
if (this.DataGrid1.View.TopLevelGroup != null) 
{                 
    var record = this.DataGrid1.View.TopLevelGroup.DisplayElements[this.DataGrid1.SelectionController.CurrentCellManager.CurrentRowColumnIndex.RowIndex]; 
} 

// to get the list of view records in sorted order 
var visibleOrder = this.DataGrid1.View.Records.ToList(); 

 

Query 2: 
Can I get items from grid in it's current visible order? 


You can achieve your requirement by using View.Records property as like below code, 

Code Snippet: 
// to get the list of view records 
var visibleOrder = this.DataGrid1.View.Records.ToList(); 
 


Please let us know if you have any other question. 

Regards, 
Muthukumar K 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;