How to make a row display always as the last row based on its cell value?
I have sorted the rows based on some column value. But there is a row which I need to display always as the last row irrespective of the sorting order. How can I do this?
Thanks.
Hi,
I created a sample using the SortComparer like I mentioned, and I got it to work, but it was really very complicated.
So I found a simpler way to do this using the Move method on the rows collection.
So basically, the sample I attached here loops through all of the rows in the grid after it's bound and finds the row that I want to always be last. In this case, it's the row whose Type is "E".I just store a reference to that row in a variable.
Then I trap AfterSortChange and use the Move method to move that row to the bottom.
Yes, I want the E row to always appear at the bottom.
Can you give me a sample project ? I have tried working on it and its a bit confusing to me.
Thanks in advance.
So you want the E row to always appear at the bottom, regardless of the date, and the regardless of whether the sort is ascending or descending? Is that right?
As I said above, the easiest way to do this would be to Fix row E at the bottom. But if you don't want that, then you would have to use the SortComparer like I suggested. I don't think grouping will help you there.
Basically, you would use a SortComparer for the Date column which also examines the Type column's value. If you are having trouble getting that to work, let me know and I will try to whip up a simple sample project for you.
This is not related to the Summary Information.
My scenario is something like this.
I have a grid with Date and Type Column.
I have three types of column values like "E, R and T".
I need to show the earliest date on top and then R on top of T and E always as the bottom row. My grid should look something like this. The type E should always display as the bottom row irrespective of its date value.
Date Type
03/07 R
03/07 T
03/08 R
03/08 T
03/07 E
What is the best way to solve this ?? Grouping ??
As I am new to Infragistics..I have never worked on grouping before... Can you please provide the sample code??
Thanks in Advance..
The SortComparer property on the grid column takes an IComparer. So what you would do is create a class that implements IComparer and handle the Compare method.
This method will get called when the grid sorts the column and it will pass you two UltraGridCell objects.
To force a particular column to always show at the bottom of the grid is a bit tricky. The simplest thing to do would be to always return that the particular value in the row you want is always higher than every other value in every other row.
But this will only work when you sort ascending. So your IComparer class will have to know which direction the grid is sorting and reverse the return value when it' sorting descending.
Can you provide some more details on why you want this row to always be at the bottom? Is this row displaying some sort of summary information? If so, then maybe you should consider using the grid's built-in summaries instead of a row of data. Summaries always display at the bottom of the list by default.