Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Setting the SortPriority
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Setting the SortPriority

 Post Reply Post Reply
Author
Message
LittleJK View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 April 2006
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote LittleJK Quote  Post ReplyReply Direct Link To This Post Topic: Setting the SortPriority
    Posted: 15 November 2006 at 6:53pm
We are encountering an issue where we are trying set the sortPriority for all our existing records to be all the same say 1 while any new record will have the sortPriority to 0. The desired result would be that the new record(s) will  always on top, which when changing the sort by columns the new record(s) will be on top while anything below will be re-sorted based on the column that is sorted.

thanks 
Back to Top
LeeHayton View Drop Down
Senior Member
Senior Member
Avatar

Joined: 25 November 2005
Location: United Kingdom
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote LeeHayton Quote  Post ReplyReply Direct Link To This Post Posted: 16 November 2006 at 10:59am
Why not use 2 groups - one for the new records and on for the existing - and have the new group first.
Then you can sort within the groups any way you like.
Back to Top
Fossil View Drop Down
Groupie
Groupie
Avatar

Joined: 29 April 2006
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote Fossil Quote  Post ReplyReply Direct Link To This Post Posted: 19 November 2006 at 2:59pm
In order to have all newly added rows to be gaurenteed on top of the report control I have created a workaround.  First of all I added a new column called NEWRECORD and turned its visibility to False.  Then turned AutoColumnSorting to false on the control and added the following code to my form.

Private bDrag as Boolean

Private Sub OOS_ReportControl_ColumnOrderChanged()

    bDrag = True
   
End Sub

Private Sub ReportControl_MouseUp(Button As Integer, Shift As Integer, x As Long, y As Long)
   
    Dim Column As ReportColumn

    If Not bDrag Then
        Select Case Me.ReportControl.HitTest(x, y).ht
            Case xtpHitTestHeader
                Set Column = Me.ReportControl.HitTest(x, y).Column
                If Not Column Is Nothing Then
                    If Column.Sortable Then
                        Column.SortAscending = Not Column.SortAscending
                        Me.ReportControl.SortOrder.DeleteAll
                        Me.ReportControl.SortOrder.Add Me.ReportControl.Columns.Find(COLUMN_NEWRECORD)
                        Me.ReportControl.SortOrder.Add Column
                        Me.ReportControl.Populate
                    End If
                End If
            Case xtpHitTestGroupBox
                Set Column = Me.ReportControl.HitTest(x, y).Column
                If Not Column Is Nothing Then
                    Column.SortAscending = Not Column.SortAscending
                    Me.ReportControl.Populate
                End If
        End Select
    End If
   
    bDrag = False
   
    Set Column = Nothing

End Sub
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.