Hi,
e.Layout.Bands[0].SortedColumns.Add("Date", false, true);
Group by column is done using above code but my problem is I dont want sorting on Date Column. Following is the example of Data in data table and its display in grid with sorting of Date column That i don't want.
Is there any other way to Group Column in code?
The grid must sort the data before it can be grouped, becasue the rows with similar values must be next to each other.
Hi Mike, If i want to Rearrange row after sort then in which event should i write code? and and which property i have to set for change the row index?
Hi Hiren,
I don't think you can. Grouping and sorting are tightly tied together. In order for rows to be grouped, they have to be together. The way grouping works is that the grid sorts the rows and then loops through the rows looking for values that are the same and that are next to each other. If the rows were not sorted, then you could end up with two different groups that both have the same value, which would not make any sense.
I think there is a method on the Rows collection called Move or Reposition or something like that, which you can use to move a row. But I'm not sure what effect that will have on grouping. It might not work.
Thanks Mike
I have solved that issue using Move method.
Thanks & Regards,
Hiren Kalavadia
Hiren,
Can you please explain briefly how did you use Move method to solve the above issue?
Regards,
Sunil
After Bind method.
if you will write ultraGrid1.Rows.count it will the total of group rows. it wont give the total rows in dataset. So as per you convient moves row by following statement
ultraGrid1.Rows.Move(column,index)
Hi Chris,
The way OutlookGroupBy works is that the grid column is first sorted by the value, and then the group loops over the rows looking for values that match up. So if your cell values are custom objects, then when the grid tries to check if one is equal to another, it will do a reference comparison and they will never be equal. If you want different objects with the same value to be considered equal to each other, you will either need to override the Equals method on the object or implmenet your own ICustomGroupByEvaluator for the grid column.
Okay, this is clearing some things up somewhat. Thank you.
Next problem: I am binding a list of objects of type A to the grid. Each object A has a property B which is another type of object. In the column that edits B, I have a dropdown containing the list of valid B objects that can be assigned to A. When I group by B, I get multiple groups for the same value of B (b1, b1, b1, b2, b2, b2, b3, b3, b3) instead of 1 group for each value of B (b1, b2, b3). Can you point me in the right direction for dealing with this?
Also, is there any way to get an add-row on the grid while it is in group-by mode? Finally, so I don't have to keep bothering you every time I hit the next stumbling block, do you have any extensive sample applications of the Ultragrid using rich complex objects as a data source?
Thanks,
Chris McKenzie
Groups and OutlookGroupBy are two different things and you seem to be mixing them up - which is understandable since that have such similar names. But you have to be careful about that. GroupHeadersVisible deals with Groups, which are column groupings - it has nothing to do with OutlookGroupBy.
Anyway, my guess is that your OutlookGroupBy isn't working because you need to set the grid.DisplayLayoutViewStyleBand on the grid to OutlookGroupBy.
Okay, let's set some preliminary context. I have a list of objects which among other properties has a "Level" property. "Level" here is some arbitrary integer value.
Now I have the following two lines of code:
Me.Control.Bands(0).SortedColumns.Add("Level1", False, True) Me.Control.Bands(0).GroupHeadersVisible = True
Let's say I have 3 objects where "Level1"=1, and 3 where "Level1" = 2.
From the documentation ( http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v8.2~Infragistics.Win.UltraWinGrid.UltraGridGroupByRow.html ) I would expect to see a an UltraGridGroupByRow which is expandable to view three rows that contain a Level1 property = 1, and a second UltraGridGroupByRow expandable to view three rows where Level1=2.
What I'm seeing instead is no row representing any kind of grouping. Rather, the rows are sorted by the Level1 property as expected, but other than the sort, there is no visible grouping of any kind in the control.
I've tried experimenting with the UltraGridGroup class as well. Adding an UltraGridGroup class does create a Group Header, but it doesn't actually contain any rows. All rows are still in the bottom of the grid.
I've been unable to find any documentation or samples that show how this is supposed to actually work.
I don't understand your question. The very first post in this thread gives you the line of code you would use in order to group a column programmatically. You call the SortedColumns.Add method and pass in true for the groupBy parameter.