SharpGrid Support

Started by DrMueller at 03-13-2009 9:42 AM. Topic has 6 replies.

Print Search Rate
Sort Posts:    
   03-13-2009, 9:42 AM
DrMueller is not online. Last active: 10/24/2011 2:31:43 PM DrMueller

Top 100 Posts
Joined on 10-05-2006
Posts 85
AfterGroupChange Event and its parameters

Attachment: screens.zip
Hello guys,
I have a small problem:
When I want to group my records on a columnheader, which isnt the first one, the AfterGroupChange parameter GroupOrColIndex just gives me the first column, not the column, which I want to group with.

I attached some screenshots, its in german, but it doesnt matter what the meaning is. The value on the messagebox is the caption of the column-header, which I print out with the GroupOrColIndex  value.

I hope you see what I mean.

best regards


Müller Matthias

   Report 
   03-16-2009, 5:10 AM
Andrey - DD is not online. Last active: 8/25/2011 5:42:49 PM Andrey - DD

Top 25 Posts
Joined on 08-01-2007
Russia, Novosibirsk
Posts 671

DDStaff
Re: AfterGroupChange Event and its parameters
DrMueller,

Please note that in AfterGroupChange event
:
If Operation is set to sgGroupRemove, GroupOrColIndex is the index of the dragged column.
If Operation is set to sgGroupAdd or sgGroupMove, GroupOrColIndex is the index of the dragged group.

So, in your case you are getting the index of a group, not column.

Thank you,
Andrey T.
   Report 
   03-16-2009, 6:39 AM
DrMueller is not online. Last active: 10/24/2011 2:31:43 PM DrMueller

Top 100 Posts
Joined on 10-05-2006
Posts 85
Re: AfterGroupChange Event and its parameters
So how do make it working, that the grid groups at the right column?
I looked at all events, but I cant find another one, which helps me at this situation.

Best regards
Müller Matthoas

   Report 
   03-17-2009, 5:40 AM
Andrey - DD is not online. Last active: 8/25/2011 5:42:49 PM Andrey - DD

Top 25 Posts
Joined on 08-01-2007
Russia, Novosibirsk
Posts 671

DDStaff
Re: AfterGroupChange Event and its parameters
DrMueller,

Could you give me please step by step details what are you trying to do? You can add group by dragging required column to group box or using Groups.Add method where you specify Column Key as parameter.

Thank you,
Andrey T.
   Report 
   03-23-2009, 5:25 AM
DrMueller is not online. Last active: 10/24/2011 2:31:43 PM DrMueller

Top 100 Posts
Joined on 10-05-2006
Posts 85
Re: AfterGroupChange Event and its parameters

Ok lets try step by step:
1. User clicks on one header.
2. User drops it to the grouping field.
3. all records should get grouped by this field.

But this doesnt happen, it just groups by anything.
Now I made this:

Private Sub sgSchnellErfassung_AfterGroupChange(ByVal Operation As DDSharpGridOLEDB2.sgGroupOperation, ByVal GroupOrColIndex As Long)
  sgSchnellErfassung.Columns(iNewGroupIndex).SortOrder = sgSortAscending
End Sub

Private Sub sgSchnellErfassung_BeforeGroupChange(ByVal Operation As DDSharpGridOLEDB2.sgGroupOperation, ByVal GroupOrColIndex As Long, ByVal NewIndex As Long, SortOrder As DDSharpGridOLEDB2.sgSortOrder, SortType As DDSharpGridOLEDB2.sgSortType, ShowFooter As Boolean, cancel As Boolean)
  iNewGroupIndex = GroupOrColIndex
End Sub


I take the groupIndex in the beforeGroupChange-sub and take it in the AfterGroupChange, but this doesnt work too.
I hope you see the problem now.


   Report 
   03-23-2009, 7:15 AM
Andrey - DD is not online. Last active: 8/25/2011 5:42:49 PM Andrey - DD

Top 25 Posts
Joined on 08-01-2007
Russia, Novosibirsk
Posts 671

DDStaff
Re: AfterGroupChange Event and its parameters
DrMueller,

Thank you for additional description, now, I think, I can see your problem; your #Grid items are not sorted by grouping column. To overcome this you can use the following workarounds:

Private Sub SGGrid1_BeforeGroupChange(...)
If Operation = sgGroupAdd Then
SGGrid1.Sort -1, -1, SGGrid1.Columns(GroupOrColIndex).Key, _
sgSortAscending, sgSortTypeString
End If
End Sub


Private Sub SGGrid1_BeforeGroupChange(...)
If Operation = sgGroupAdd Then
SortOrder = sgSortAscending
End If
End Sub

Thank you,
Andrey T.
   Report 
   03-25-2009, 2:30 AM
DrMueller is not online. Last active: 10/24/2011 2:31:43 PM DrMueller

Top 100 Posts
Joined on 10-05-2006
Posts 85
Re: AfterGroupChange Event and its parameters
Yes thats it.
Thanks alot

   Report 
GrapeCity » Product Support » SharpGrid Suppo... » AfterGroupChange Event and its parameters

Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.