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

Sorting when using a converter - revisited

3 Answers 78 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GEB
Top achievements
Rank 1
GEB asked on 15 Jun 2010, 04:52 PM
I have seen several threads on sorting when using a converter, but none specific to my question.  I'm currently using Q1 SP2.

I am retrieving entities via WCF RIA Services, and combining two columns into one column of the RadGridView using a converter.  The converter requires that I pass in the entire entity, and the sort for the column can only be based on the result.  Is there now a solution for binding the entire entity to a column, converting the entity into the actual column value, then sorting on that value?

Here is my specific case.  The entites returned from RIA Services have two DateTime fields.  The column is bound to the full entity, and the converter selects which of the two dates to display in the column.  That is all worikng fine.  However, I want to sort the column based on the date selected by the converter.  Any solution?

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 15 Jun 2010, 04:57 PM
Hello GEB,

In your case using the Custom sorting approach would be as close as we can get.

This includes handling the sorting event and writing a few lines of your own sorting logic to be performed . This way you override the default sorting .

In case you are not already familiar with this approach and need further assistance, just let me know.

Greetings,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
GEB
Top achievements
Rank 1
answered on 15 Jun 2010, 05:04 PM
Thanks for the very quick response.  Can you point me to the best reference for writing a custom sorting method?

Also, for the derived column, sorting is not even presented to the user.  They can sort on all other columns except that one.  If a custom sort method is written will it allow the user to sort on the derived column?
0
Pavel Pavlov
Telerik team
answered on 18 Jun 2010, 09:03 AM
Hello GEB,

The sample attached demostrates the custom sorting applied in a scenario with a value converter.

Regards,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
GEB
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
GEB
Top achievements
Rank 1
Share this question
or