Our xamDataGrid is bound to a collection. In our collection we have a field that we track internally and don't display to the user (it's not a field that has relevant meaning to the user). This field is RelativeMeasure and what it really tracks is absolute position from the start to the end of a line. In lieu of displaying RelativeMeasure, we display 4 other fields in our grid that have actual meaning to the user such as Route, Series, Station and Measure (these fields have domain meaning to the user for a location on the line). We display additional fields to the user such as % error that the user might want to sort on so we allow sorting in our grid so the user can sort by whatever column they want.
The trouble is, that the user, when they go to sort by Route, Series, Station or Measure what they are really expecting is a sort by RelativeMeasure. Is there a way when the user clicks on one of these headers that we can sort by RelativeMeasure instead of the column they selected?
Thanks!
Hello Darlene,
Thank you for your post. I have been looking into it and I can suggest you see these forum threads:
http://es.infragistics.com/community/forums/p/57047/292051.aspx
and
http://es.infragistics.com/community/forums/p/84023/419562.aspx
where similar questions as yours are already discussed. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thanks for the link suggestions.
Following the suggestion in the first link I wrote a comparer and added it as the SortComparer to my fields that I wanted sorted differently. However, in my comparer, all I'm getting is the cell value instead of the cell itself so I have no way of getting the other value from my data object.
<igDP:UnboundField Label="Series" Width="64"> <igDP:UnboundField.Binding> <MultiBinding Converter="{StaticResource SeriesConverter}"> <Binding Path="Route" Mode="OneWay"/> <Binding Path="Measure" Mode="OneWay"/> <Binding Source="{StaticResource SeriesRecordsBindingProxy}"/> </MultiBinding> </igDP:UnboundField.Binding> <igDP:UnboundField.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource RightAlign}"/> </igDP:UnboundField.Settings> </igDP:UnboundField>
The suggestion in the second link will not work for me because as you see with the xaml above, I already have a multi-value converter set on the unbound field.
Is there a way to pass the Cell or DataItem to the Comparer instead of the actual cell value?
Thanks,Darlene
Thank you for your reply. I am glad that you have managed to solve your issue.
Let me know, if you need any further assistance on this matter.
Thanks. That post matches what I was trying to do. What I ended up doing was adding my column as a collapsed column and setting the field sort description.
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.SortedFields> <igDP:FieldSortDescription Direction="Ascending" FieldName="RelativeMeasure" /> </igDP:FieldLayout.SortedFields>
<igDP:UnboundField BindingPath="ControlPoint.RelativeMeasure" BindingMode="OneWay" Name="RelativeMeasure" Label="Relative Measure" DataType="{x:Type system:Decimal}" Visibility="Collapsed">
Thank you for your reply. I was looking into your issue and the ‘SortComparer’ property passes only the value of the cells and cannot pass the cell or record itself. You could you try to programmatically add a FieldSortDescription for the hidden field to the FieldLayout's SortedFields so that you sort taking both values into account as suggested in the following forum thread :
http://es.infragistics.com/community/forums/p/22037/80211.aspx
Also you can submit a new product idea to be able to pass the Cell/DataRecord into the SortComparer's Compare method.
There are many benefits to submitting an product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.