Print Page | Close Window

Force a Sort on the Grid

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=18979
Printed Date: 23 November 2024 at 8:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Force a Sort on the Grid
Posted By: PurposeSoftware
Subject: Force a Sort on the Grid
Date Posted: 23 September 2011 at 7:36am
I add a record to the grid, do a Populate but the new item isn't inserted into the correct position.

If I click the column header twice to sort (1st time to sort the wrong way then the 2nd to sort the right way) it will sort correctly.

So, how do I force a Sort of the grid.

Ie. wndReport.Sort

Colin
PurposeSoftware




Replies:
Posted By: Aaron
Date Posted: 04 November 2011 at 2:30pm
Hi,
 
Seems you have same problem as: http://forum.codejock.com/forum_posts.asp?TID=19020&title=new-row-does-not-sort-properly - http://forum.codejock.com/forum_posts.asp?TID=19020&title=new-row-does-not-sort-properly
 
If a column is sorted (ASC or DESC) and after call .Populate the grid is sorted again. Can you upload some kind of test project which shows your problem?
 
Sort columns by code: use SortOrder collection. Here's Sample from CJ (see Help)
 

Example

[Sorting columns in the ReportControl (Visual Basic)] This sample illustrates how to sort the columns in the ReportControl. If you had 8 columns added to the ReportControl, this sample would sort the columns first by the column at Itemindex 7, then by the column at ItemIndex 2, then by the column at ItemIndex 5.

    'This code below will add three columns to the SortOrder collection of coluns.
    'This will cause the columns in the ReportControl to first be sorted by column 7,
    'which has an index of zero (0) in the SortOrder collection. Columns are first sorted
    'in the order that they are added to the SortOrder collection.
    wndReportControl.SortOrder.Add wndReportControl.Columns(7)
    wndReportControl.SortOrder.Add wndReportControl.Columns(2)
    wndReportControl.SortOrder.Add wndReportControl.Columns(5)

    'This will cause the column at index 1 of the SortOrder collection to be sorted
    'in descending order.
    wndReportControl.SortOrder(1).SortAscending = False

    'Any time you add or delete columns to the SortOrder or GroupOrder collections,
    'the Populate method must be called to show the changes in the ReportControl's view.
    wndReportControl.Populate

See Also

mk:@MSITStore:C:%5CProgram%20Files%5CCodejock%20Software%5CActiveX%5CXtreme%20SuitePro%20ActiveX%20v15.0.1%5CHelp%5CSymbolReference.chm::/XtremeReportControl~ReportColumnOrder.html - ReportColumnOrder Collection  |  mk:@MSITStore:C:%5CProgram%20Files%5CCodejock%20Software%5CActiveX%5CXtreme%20SuitePro%20ActiveX%20v15.0.1%5CHelp%5CSymbolReference.chm::/XtremeReportControl~ReportControl~SortOrder.html - ReportControl SortOrder Property  |  mk:@MSITStore:C:%5CProgram%20Files%5CCodejock%20Software%5CActiveX%5CXtreme%20SuitePro%20ActiveX%20v15.0.1%5CHelp%5CSymbolReference.chm::/XtremeReportControl~ReportControl~GroupsOrder.html - ReportControl GroupsOrder Property

Example

mk:@MSITStore:C:%5CProgram%20Files%5CCodejock%20Software%5CActiveX%5CXtreme%20SuitePro%20ActiveX%20v15.0.1%5CHelp%5CSymbolReference.chm::/XtremeReportControl~ReportControl~GroupsOrder.html - GroupsOrder Sample

 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



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