Print Page | Close Window

Need help repostioning records

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=9459
Printed Date: 21 December 2024 at 10:21pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Need help repostioning records
Posted By: ChaosM
Subject: Need help repostioning records
Date Posted: 31 January 2008 at 11:19am
Hello,
 
I would like to add the ability to move a selected record up or down in the report control. The docs say that "InsertAt" will move the record where I want, however it's only creating a copy of the record and placing it in the new location. Also, both the original record and the copied record have the same record.index value. I am using the first column as a treeview and there are children.
 
I have tried both of the following with the same results
 
 
        Case ID_MOVEUP
            Set Record = rc.SelectedRows(0).Record
            NewIndex = Record.Index - 1
            rc.Records.InsertAt NewIndex, Record
            rc.Populate
 
        Case ID_MOVEUP
            rc.Records.InsertAt _
                   rc.SelectedRows(0).Record.Index - 1, _ 
                   rc.SelectedRows(0).Record
            rc.Populate
 
 
Is this the better way?  Is there an example?
 
Thank you!
 



Replies:
Posted By: ChaosM
Date Posted: 31 January 2008 at 11:33am
Actually i got it to work by removing the old record first. Not sure if this is the intended design.
 
        Case ID_MOVEUP
            Set Record = rc.SelectedRows(0).Record
            NewIndex = Record.Index - 1
            rc.Records.RemoveAt Record.Index
            rc.Records.InsertAt NewIndex, Record
            rc.Populate
 
        Case ID_MOVEDOWN
            Set Record = rc.SelectedRows(0).Record
            NewIndex = Record.Index + 1
            rc.Records.RemoveAt Record.Index
            rc.Records.InsertAt NewIndex, Record
            rc.Populate
 
 
Still interested in knowing if why InsertAt didnt just move the record just by passing the new record.index.
 
Thanks



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