Hi,
Im using the 2007 Vol 1 CLR 1.x version of Infragistics, and am looking to set up custom sorting. Basically, I have an unbound column that I'm dynamically populating with a combination of three hidden columns (Salutation, Firstname, Surname - so the output on the unbound column looks like 'Mr Joe Bloggs'). When the user chooses to sort by this unbound column, I want to set the grid to actually sort by another column, but still show that its sorting by the visible column.
I managed to find the linked page (http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=5208) which looks like it does pretty much exactly what im looking for. However, I'm trying to do this using the ultrawingrids on .Net 1, and I cant seem to find the two events used in the examples. Is there any way to do this in CLR 1?
Thanks
Fergal
Hi Fergal,
The article you linked here appears to be referring to UltraWebGrid, not UltraWinGrid. So it's no surprise that you can't find the events.
To acheive what you want in UltraWinGrid is pretty easy, though. What you would do is write a class that implement IComparer and set the SortComparer property of your combined column to an instance of this class.
The IComparer interface only has one method: Compare. It will pass in two grid cells to compare. So you can examine the text of the cells themselves, or if you like, you can look at the other cells in the same row to determine the order.
Mike,
Thanks for your response. I'd actually noticed not long after posting my error, and saw the article about the Comparer class, just figured I would hold out, see if you guys had another solution.
The ICompare class should be suitable for us though. Thanks for your help.
Are you sure you are looking at the correct column? The DataType of the grid column should be the same as the type of the DataTable column. If it's not, then something is seriously wrong.
Do you have a sample demonstrating this?
I am having a similar problem. I have a DataTable with a column declared as an Int type. When I bind the DataTable to the Ultragrid, the corresponding UltrGridColumn's DataType property is showing 'string'.. Do I need to set something else so it sorts as an Int?
Hm, there's no reason why an int column should not sort. Unless maybe the HeaderClickAction on the column is set to one of the External settings.
Can you duplicate this behavior in a small sample project? If so, you should Submit an incident to Infragistics Developer Support and include the sample so they can check it out.
What's the data type of the column? Perhaps is not a comparable type.