Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multi column sorting in grid
Message
De
22/10/2011 07:26:00
 
 
À
21/10/2011 20:42:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01526657
Message ID:
01527087
Vues:
60
Hi Frank.

Attached is a jpeg of what it looks like. - Well I tried to attach the jpeg but it was too big, so you will have to use your imagination.

This is how I set up the RecordSource for the "Sort By" grid:
***********************************************************************
*** Changed By.: Marcia G. Akins on 19 August 2005
*** Reason.....: allow for multiple column sort
***********************************************************************
CREATE CURSOR csrSortOrder (;
  iKey I, ;
  lUse L, ;
  cType C( 1 ), ;
  DisplayName C( 25 ), ;
  SortOrder I, ;
  FieldName C( 20 ), ;
  lDescending L )
INSERT INTO csrSortOrder VALUES ( 1, .T., [D], [Wanted By Date], 1, [Reqd_Date], .T. )
INSERT INTO csrSortOrder VALUES ( 2, .T., [C], [Vendor], 2, [Vendor], .F. )
INSERT INTO csrSortOrder VALUES ( 3, .T., [C], [Client], 3, [Client], .F. )
INSERT INTO csrSortOrder VALUES ( 4, .F., [N], [P.O. Number], 4, [PO_id], .F. )
INSERT INTO csrSortOrder VALUES ( 5, .F., [C], [List Name], 5, [List_Name], .F. )
INSERT INTO csrSortOrder VALUES ( 8, .F., [D], [Date Received], 6, [Date_Received], .T. )
INSERT INTO csrSortOrder VALUES ( 9, .F., [C], [Invoice Number], 6, [vendor_invoice_no], .T. )
SELECT csrSortOrder
INDEX on SortOrder TAG SortOrder

***********************************************************************
*** Changed By.: Marcia G. Akins on 20 August 2005
*** Reason.....: Set the default sort order
***********************************************************************
Thisform.cOrderBy = [Reqd_Date DESCENDING, Vendor, Client]
And this is the code that gets executed when you click on the Sort Now button:
LOCAL lcSortExpr
SELECT csrSortOrder
lcSortExpr = []
SCAN FOR lUse
  lcSortExpr = lcSortExpr + ALLTRIM( FieldName ) + ;
           IIF( lDescending, [ DESCENDING, ], [, ] )
ENDSCAN
***********************************************************************
*** Changed By.: Marcia G. Akins on 01 September 2005
*** Reason.....: If they have no sort expression, leave in natural order
***********************************************************************
IF EMPTY( lcSortExpr )
  lcSortExpr = [PO_id]
ENDIF
***********************************************************************
IF RIGHT( lcSortExpr, 2 ) == [, ]
  lcSortExpr = LEFT( lcSortExpr, LEN( lcSortExpr ) - 2 )
ENDIF
Thisform.cOrderBy = lcSortExpr
*** Now reselect the items in the grid in the correct order
SELECT * FROM csrPurchase_hdr ORDER BY &lcSortExpr INTO CURSOR qTmp NOFILTER
SELECT csrPurchase_hdr
ZAP
APPEND FROM DBF( [qTmp] )
GO TOP IN csrPurchase_hdr
Thisform.grdcsrPurchase_hdr.SetFocus()
Details on how to implement the "Sort Order" grid with the mover bars is in the Kitbox Column I mentioned in my previous message.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform