Print Page | Close Window

Setting the SortPriority

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=5534
Printed Date: 18 September 2024 at 10:45pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Setting the SortPriority
Posted By: LittleJK
Subject: Setting the SortPriority
Date 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 



Replies:
Posted By: LeeHayton
Date 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.


Posted By: Fossil
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net