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.
Unfortunately, activation email could not send to your email. Please try again.

Datagrid Sort on expandoObject

Thread ID:

Created:

Updated:

Platform:

Replies:

107968 Mar 26,2013 12:29 PM Jun 28,2013 08:57 AM WinRT 7
loading
Tags: SfDataGrid
marco
Asked On March 26, 2013 12:29 PM

I need to create columns at runtime. The requirements are that at runtime we don’t know how many columns we will have.  For this we used either a dictionary or an ExpandoObject, which implements the IDictionary interface internally, with no success.

Although the data is visible using the MappingName, we cannot use the default sorting and grouping from the DataGrid.

Mapping using the Dictionary approach (where index 0 resembles an ID field):

grdTest.Columns.Add(new GridTextColumn() { Width = 150, HeaderText = "ID", MappingName = "Properties[0]" });

or using the ExpandoObject approach:

grdTest.Columns.Add(new GridTextColumn() { Width = 150, HeaderText = "ID", MappingName = "ID" });

 

We get the following exception when we click on a header to sort the grid.

System.ArgumentException

   at System.Linq.Expressions.Expression.PropertyOrField(Expression expression, String propertyOrFieldName)

   at Syncfusion.Linq.QueryableExtensions.GetValueExpression(ParameterExpression paramExpression, String propertyName, Type sourceType)

   at Syncfusion.Linq.QueryableExtensions.GetLambdaWithComplexPropertyNullCheck(IQueryable source, String propertyName, ParameterExpression paramExpression)

   at Syncfusion.Linq.QueryableExtensions.OrderBy(IQueryable source, String propertyName, Type sourceType)

   at Syncfusion.WinRT.Data.QueryableCollectionView.SortQueryable(IQueryable source)

   at Syncfusion.WinRT.Data.QueryableCollectionView.RefreshSort()

   at Syncfusion.WinRT.Data.CollectionViewAdv.EndDeferInternal()

   at Syncfusion.WinRT.Data.CollectionViewAdv.EndDefer()

   at Syncfusion.WinRT.Data.CollectionViewAdv.DeferHelper.Dispose()

   at Syncfusion.WinRT.Data.CollectionViewAdv.EndInit()

   at Syncfusion.UI.Xaml.Grid.GridModel.MakeSort(GridColumn Column, ListSortDirection direction)

   at Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.Sort()

   at Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.OnTapped(TappedRoutedEventArgs e)

 


Prakash Selvaraj [Syncfusion]
Replied On March 27, 2013 08:34 AM

Hi Marco,

 

Sorry for this inconvenience caused.

 

As of now we have not provided support for dynamic objects. We have planned to implement the Dynamic Object support in our next release, our next release will be available in middle of May 2013.

 

This exception occurs since we are using reflection to get the value from the objects that are bound to the DataGrid. In your case, by using the reflection we are not able to get the value from the Dynamic Objects (ExpandoObject). So, while clicking the column header DataGrid will throw the exception. Currently to avoid that exception, you can disable the sorting and grouping option in DataGrid.

 

Please let us know if you need further assistance.

 

Regards,

Prakash S.


Prakash Selvaraj [Syncfusion]
Replied On May 27, 2013 01:48 PM

Hi Marco,

 

We are glad to announce that our  Essential Studio Vol 2 2013 is rolled out and is available for download under the following link

 

http://www.syncfusion.com/support/forums/general/108998/Essential-Studio-2013-Volume-2-Final-Release-v112025-available-for-download-

 

 Please find the release notes in the following link

http://files2.syncfusion.com/Installs/v11.2.0.25/ReleaseNotes/WinRT.html

 

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

 

Regards,

Prakash S.



marco
Replied On June 5, 2013 11:10 AM

Hi, I implemented the datagrid with dynamic objects as datasource.  At first glance everything seems to work fine.  But when I move columns or scroll horizontally or group the data, the data is not shown correctly anymore.   A quick example:  

After initial load: 
Property 1             Property 2                Property 3                Property 4

1                            1                                    1                                1
2                            2                                    2                                2
3                            3                                    3                                3
4                            4                                    4                                4


After column Switch

Property 3             Property 1                Property 2                Property 4

1                            1                                    1                                1
2                            2                                    2                                2
3                            3                                    3                                3
1                          4                                    4                                4

If i check the datasource in codebehind after the column switch, everything is as it should be.
Any idea what could be the problem?

br
Marco


Dineshprabhu V [Syncfusion]
Replied On June 11, 2013 02:46 AM

Hi Marco,

 

Sorry for the inconvenience caused.

 

We have analyzed the reported issue with our sample; we are not able to reproduce the issue. Could you please check the below sample?

 

Sample: http://www.syncfusion.com/downloads/Support/DirectTrac/91540/SampleTest822887180.zip

 

We suspect you are using our grid in some other scenario, could you please modify our sample and revert with the replication procedure, which would be very helpful to resolve the issue.

 

Please let us know if you have any concerns.

 

Thank you,

Dineshprabhu V

 


marco
Replied On June 12, 2013 04:42 AM

Hi,

I managed to recreate my problem with your application. (see attachment)

The main difference is that you declare the columns in xaml, where I create them in codebehind (depending on the number (and names)  of properties of the dynamic object.  That's also the reason why I need a dynamic object, because I don't know how many properties there will be and what the names of those properties will be...

 

br,

Marco



SampleTest_58040fb8.zip

Dineshprabhu V [Syncfusion]
Replied On June 14, 2013 08:52 AM

Hi Marco,

 

Sorry for the inconvenience caused.

 

We have considered the reported problem as a defect in our source and a fix for this defect will be included in the upcoming service pack which will be available in next week.

 

Please let us know if you have any concerns.

 

Thank you,

Dineshprabhu v


Sankara Narayanan N [Syncfusion]
Replied On June 28, 2013 08:57 AM

Hi Marco,

 We are glad to announce that our Essential Studio Vol 2 service pack 2013 is rolled out and is available for download under the following link.

 http://www.syncfusion.com/support/forums/winrt/109691/Syncfusion-Essential-Studio-for-WinRT-%28XAML%29-v112029-%28Service-Pack%29-available-for-download-

 We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

 Regards,

Sankar


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.

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.

;