I use the ultragrid control to show some information, then two amounts columns.
The last row shows the totals, but that row only said “Totals” on the first column and the last two columns have the total amounts.
The last row (the total one) has a distinct background color
The problem is that when I click the header to sort the grid, for example over the date column, the total row goes to the top, I can’t make it to stay on the bottom (and I don’t want to use fixed row, because is give a gap between the rows with data and that last row which goes to the bottom, to display on this way is very awful).
I have looked everywhere on the Internet and on your forum for an answer, but nothing gives me an idea on how to accomplish this.
I looked to see if there’s a code to sort by color, but I got nothing.
I tried to use a hidden column, neither work.
Can someone give me light?
Never Mind
I got it
Thanks a lot, great service
ariel
Thanks lot for the fast answer.
I can use summary row, I don’t even knew that exist.
Can you offer a link with examples, I assume on the forum or internet should be posting on that, Please.
Hi,
How are you creating your totals rows? Is it a regular data row in your data source? Or are you using a summary row.
Summary Rows don't get sorted, so it sounds like you should be using a summary row instead of a data row. You can add a summary row to the bottom of the rows collection. To do this, you use the band.Summaries.Add method. The InitializeLayout event is typically a good place to do this.
If, for some reason, you cannot use a SummaryRow and you want to use a regular row of data to represent your summaries, then you would have to handle the sorting using a SortComparer. This is a fairly difficult sort comparer to do, because you have to adjust the results of the comparison based on the sort direction. When the column is sorted ascending, you want the totals row to be greater than every other row, but when it's descending, you want it to be less than the other rows. To further complicate this, the user could be sorting more than one column at a time, so you would have to deal with this based on the first sorted column.
I'd recommend the summary row. It's a lot easier.