Hallo!
How can I expand a Ultrawingrid group on runtime?
I have got a Wingrid with one band, grouped by month name ("01- January", "02 - February", ...). The groups are generally not expanded when I open the form. I want to expand the group of the actual month when I open the form.
select case month(now.date)
case 1
'expand group of "01 - January"
...
end select
What is the code for expanding?
Thank you.
UltraGridRow exposes an Expanded property, which you can set to true to expand the row (UltraGridGroupByRow derives from UltraGridRow) You can handle the InitializeGroupByRow event and use that event as a trigger for expanding the GroupBy row.
Hallo, Brian!
Thank you for your answer. But I haven't really understood.
Maybe you could give me a code example.
Thank you
Marco
Hello all,
I have been trying to do something similar. Expanding the first groups results.
With uwGrid_Documents.DisplayLayout.Bands(0) .Columns("ID").Hidden = True .Columns("Link").Hidden = True
.SortedColumns.Add("Company", False, True) .SortedColumns.Add("Area", False, True) .SortedColumns.Add("Group", False, True) .SortedColumns("Company").Expand(True) ' ?? How to do something like this ? ?? End With
I have tried the uwGrid_Documents_InitializeGroupByRow as detailed and it does work.
Try Select Case e.Row.Column.Header.Caption Case "Company" e.Row.Expanded = True Case Else
End Select Catch ex As Exception
End Try
Just wondering if there was a easier way to do that.
Thanks
Deasun.
Hi Deasun,
Yes, there is an easier way:
With Me.UltraGrid1 With .DisplayLayout.Bands(0) .SortedColumns.Add("Int32 1", False, True) .SortedColumns.Add("Int32 2", False, True) End With .Rows.ExpandAll(False) End With
Morning,
Thanks for the reply.
That looks like it adds to group columns and then has them not expanded.
What if you just wanted the first one expanded? Or did I miss something?
The call to ExpandAll in my sample code expands the first level of GroupByRows. Isn't that what you were asking for?
aye it is.
So if its given a FALSE it does one and one a TRUE it does all.
Thanks for the quick replies.
Deasun