After a user groups a column, then chooses columns to display, how can i "regroup" and recalculate accordingly the rows being grouped? something similar to SQL grouping
if you can see in the screenshot, what i want to know is, how to recalculate the rows, (and remove other rows) if my user removes the customer code field distinct to the non-numeric type. (in this view, this is not the only columns, there are 50+ columns, only hidden for this screenshot)
Hi,
I'm sorry, but I do not understand what you are asking.
thanks for the reply .. sorry if this is a little hard to understand,the screenshot was done by the following sql query:select column1, column2, amount, 1 month, 2 month from table group by column1, column2if the user deselects column1 (hide it from the display) i want the display like the way sql query do it ..so it will be like the following queryselect column2, amount, 1 month, 2 month from table group by column2executing this query,the results will be (please refer to screenshot), the first group (12/30/2011) will have 2 rows (since it will be grouped by order type, GA and IS), the second group (12/31/2011) will have 1 row ..i hope this is a bit clearer...
I'm afraid I am still lost. Are you sure you posted the right screen shot? It doesn't look anything like you are describing.
joe_coder28 said:select column1, column2, amount, 1 month, 2 month from table group by column1, column2
I don't see column1 or column2 here. I assume that's because of the grouping. But it's a bit confusing that you even mention these, since as far as the grid is concerned, they don't exist. There are also a whole bunch of columns in the grid that you are not getting from your select statement. I guess those are unbound columns?
Also, the grid is grouped by the Due Date column, which you also don't mention here at all.
joe_coder28 said:if the user deselects column1 (hide it from the display) i want the display like the way sql query do it ..
I don't understand what you mean. This column is already not visible here. So how can the user hide it when it's already not there?
joe_coder28 said:i hope this is a bit clearer...
I'm afraid not... if anything, it's making less and less sense to me.
sorry if this taking so long, but let me try it this way..this is actually equivalent to the screenshot's columns:select customer code, order type, due date, amount, sum(data1) as 1 month, sum(data2) as 2 monthgroup by due date, customer code, order typeand everything here is binded in the grid, no unbound columnif i take out customer code (via column chooser), my display should be the result equivalent to this query:select order type, due date, amount, sum(data1) as 1 month, sum(data2) as 2 monthgroup by due date, order type
So... you are hiding the column via the column chooser and the grid is still grouped by that column.
If the grid is grouped by a column, then by default, that column is already hidden automatically. You cannot hide it using the ColumnChooser, because the ColumnChooser will already show it as unchecked (hidden).
Assuming you changed this, but setting HiddenWhenGroupBy on the column to false, then I guess you are asking how to ungroup the column when it gets hidden by the user.
That's very easy to do:
private void ultraGrid1_AfterColPosChanged(object sender, AfterColPosChangedEventArgs e) { if (e.PosChanged == PosChanged.HiddenStateChanged) { UltraGridColumn column = e.ColumnHeaders[0].Column; if (column.Hidden && column.IsGroupByColumn) { column.Band.SortedColumns.Remove(column); } } }
This is really the exact requirement with mine: http://es.infragistics.com/community/forums/t/72681.aspx
Hope to get the reply.
Thanks.
I'm sorry, but I still don't understand what you want here. It looks like you want the grid to combine several rows into one row. The only way to do that is by grouping. In this case, you would have to group by two field: first by Due Date and then by Order Type.
This would result in a 3-level hierarchy in the grid - the first two level would show GroupBy Rows and the third level would be the only one that shows data rows that have cells in them.
The grid will never display a GroupByRow with normal editable data cells in it, although you could have summaries in a GroupByRow which appear aligned with the column like cells.
What you are showing here with the text in your post are data rows where the values of some cells have been combined into a single row and summed up. So this would have to be done by using a summary, or else you would have to do this on your data source and not in the grid.
hi, you're almost there.. but my concern is about the data being displayed. (i just reattached the screenshot),in my screenshot is two groups, the one .. 12/30 and the other is 12/31.. but by means of sql query, removing the customer code in the grouping statement will result like this12/30/2011order type | amount | current | 1 month | 2 monthsGA | 5,400 | 0 | 0 | 0 IS | 11965.1 | 0 | 0 | 012/31/2011order type | amount | current | 1 month | 2 monthsIS | 50,279 | 0 | 0 | 0this result is obtained by matter of sql query result..