Hello,
In the WinGrid, it seems that only 1 summary row is allowed. My problem is that I need more than 1 summary row, because I need to summarize the data in multiple ways. First I need a Total Cost summary, and below that I need average cost. After that, there are several other custom summaries that I need to add.
Since I don't think that I can create multiple summaries, I've partially solved this problem by adding the summary rows to the bottom of my datatable. This does not solve the problem because sorting the data causes the summary rows to get sorted along with the rest of the data.
I've partially solved the sorting problem by setting the "Fixed" property of the summary rows to True. I also set the DisplayLayout.Override.FixedRowStyle property = FixedRowStyle.Bottom. This allowed me to get the summary rows on the bottom of the grid. The only problems that I still have is that, if the user sorts the data, these rows that contain summary data still get sorted at the bottom of the grid. I don't want these rows to be sorted at all.
So here are my questions:
1) Is there a way to add multiple summary rows as I've explained above? I'm assuming that the answer to this question is no.
2) Can I have the default sorting code for the grid "skip" a row in the sorting process so that it stays in its original position.
3) I'd also like to get these rows that contain summary data to look like summary rows. Is there any way that I can simply apply the summary row appearance to these rows instead of the standard row appearance, or do I need to create my own appearance class for these rows?
rexCho said:1) Is there a way to add multiple summary rows as I've explained above? I'm assuming that the answer to this question is no.
Never assume. Yes, you can have as many summary rows as you like. In fact, it's very easy and you really don't even have to do anything. Just add more than one summary aligned to the same location. That is, add more than one summary to the same column or more than one summary aligned Left (or right, or middle). The second summary will appear on a second line, and so on and the grid will create as many lines of summaries as it needs.
rexCho said:2) Can I have the default sorting code for the grid "skip" a row in the sorting process so that it stays in its original position.
This is tricky, but it can be done using a SortComparer on the column. But in light of the answer to question 1, you probably don't need it.
rexCho said:3) I'd also like to get these rows that contain summary data to look like summary rows. Is there any way that I can simply apply the summary row appearance to these rows instead of the standard row appearance, or do I need to create my own appearance class for these rows?
Again, in light of the answer to question 1, I think this question is moot.
Thanks Mike. You are right. I made a bad assumption. I should have just tried adding multiple summaries to the same column and it would have worked. I appreciate your help.