I don't know if this is doable with the Grid. If all else I'll have to recall the stored procedure.
The DataTable we use for our grid has various Sum summaries and Custom Summaries. We have also added the built in function for user to utilize the Column Chooser. If they choose a column to hide the column disappears, but the rows are still there as if the column was still there. The rows don't collapse down to to correct summations if that column was truly gone.
If the data is like this
Company Customer CustomerState SumUnitsSold SumWeight
Texas Cust1 WI 100 1,000
Texas Cust1 WI 4 50
Maine Cust2 NA 50 200
And we hide the Customer via the Column Chooser we want the data to be reformulated as such...
Company CustomerState SumUnitsSold SumWeight
Texas WI 104 1,050
Maine NA 50 200
Is this possible within grid control? Or will I have to do like I suspect and requery the database with the appropriate flags to return just the columns that we want?
Thanks in advance,
Tim
Thanks again for you advice. It looks like I am going to have hit the stored procedure again.
Hi Tim,
It looks like what you want to do here is use the OutlookGroupBy feature and group on the Customer column rather than hiding that column.
But to answer your question, the answer is no, the grid won't automatically merge your data when you remove a column, that would have to be done on the data source.
Try the OutlookGroupBy, though. I think it might suit your needs here.
EDIT: Oh.. .to group in code, you use the band.SortedColumn.Add method and specify true for groupBy (the last param).