Print Page | Close Window

Automatic sorting

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=5686
Printed Date: 19 September 2024 at 12:55pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Automatic sorting
Posted By: cryo75
Subject: Automatic sorting
Date Posted: 05 December 2006 at 2:56am
Hi,
 
I've got a reportcontrol with just one column, and it's set to be sorted in ascending order.
 
When I add records to the control, they are not automatically sorted but simply added to the bottom of the list.
 
How can records be automatically sorted when added?
 
Thanks,
Ivan
 



Replies:
Posted By: cryo75
Date Posted: 06 December 2006 at 12:25pm
bump!!


Posted By: Oleg
Date Posted: 07 December 2006 at 12:58am
it must work. do you call Populae method?

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: cryo75
Date Posted: 07 December 2006 at 1:12am
Yes I do but it still doesn't work.
 
Reportcontrol and column are setup like this:
 
    'Create grid
    With grdList
        .AllowColumnRemove = False
        .AllowColumnReorder = False
        .AllowColumnResize = False
        .AllowColumnSort = True
        .BorderStyle = xtpBorderFrame
        .MultipleSelection = True
        .PaintManager.HighlightBackColor = &HC6F3FF
        .PaintManager.HighlightForeColor = vbBlack
        .Columns.DeleteAll
       
        Set oCol = .Columns.Add(ID_GRID_LOCATION, oLang.Translate(1201), 400, False)
        oCol.AutoSize = True
        oCol.Sortable = True
        oCol.SortAscending = True
    End With
   
 
And I add a record like this:
 
    Dim lRow As Long
    Dim oRow As ReportRecord
    Dim oItm As ReportRecordItem
   
    lRow = GetRowByID(Item!ID)
   
    With grdList
        'Add to the list
        If lRow = 0 Then
            Set oRow = grdList.Records.Add
           
        'Get current record
        Else
            Set oRow = grdList.Records(lRow)
        End If
       
        'Set the properties
        Set oItm = oRow.AddItem(vbNullString)
        With oItm
            .Value = Item!Name
            .Tag = Item!ID
        End With
        .Populate
    End With


Posted By: sserge
Date Posted: 10 December 2006 at 1:59pm
I would recommend you changing the last piece of code to the following:

'Set the properties
Dim sItemValue as String
sItemValue = Item!Name
Set oItm = oRow.AddItem(sItemValue)
oItm.Tag = Item!ID


--
WBR,
Serge



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