Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Incremental Search in Grid
Message
From
04/08/2003 07:48:14
 
 
To
04/08/2003 07:26:48
Javed Yusuf
Analytic Systems
Lahore, Pakistan
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00816396
Message ID:
00816431
Views:
23
Hi Javed.

Sorry to bother you, I also want which column I select for search must be sorted. I mean to say when I click on header of this column grid data sort on this column but remember I am using Cursor or SQL Statement for RecordSource

The easiest way to do this is to create indexes for each column that you want to sort by. Once you do this, all you need is this little bit of code, called from the Header's click() method (or using BindEvent() to associate the header's click with a custom method to do the sorting if you are using VFP 8)
LPARAMETERS tcTag

*** Make sure a valid tag name was passed
WITH This
  *** Make sure it really is a tag for the grid's RecordSource
  IF IsTag( tcTag, .RecordSource )
    lnRecNo = RECNO( .RecordSource )
    *** Go ahead and set the order for the table
    SELECT ( .RecordSource )
    SET ORDER TO ( tcTag )
    .SetFocus()
    IF lnRecNo # 0
      GO lnRecNo IN ( .RecordSource )
    ENDIF
  ENDIF
ENDWITH					
The IsTag() function looks like this:
FUNCTION IsTag( tcTagName, tcTable )
LOCAL ARRAY laTags[1]
LOCAL llRetVal
*** Get all open indexes for the specified table
ATagInfo( laTags, "", tcTable )

*** Do a Case Insensitive, Exact=ON, Scan of the first column of array
*** Return Whether the Tag is Found or not
RETURN ( ASCAN( laTags, tcTagName, -1, -1, 1, 15 ) > 0 )
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform