Board index » delphi » Sorting tables (Excel like)

Sorting tables (Excel like)


2003-12-02 06:26:36 PM
delphi126
I want to implement sort on my tables like I do this in Excel, i.e.
i want to have sort in ascending and descending order and sort on more then one column (at the same time like in Excel).
I need example code!
Thank you in advance!!!
 
 

Re:Sorting tables (Excel like)

gesim writes:
Quote
I want to implement sort on my tables like I do this in Excel, i.e.
i want to have sort in ascending and descending order and sort on more then one column (at the same time like in Excel).
I need example code!
If you are displaying the results in a TDBGrid, respond to the
OnTitleClick event, and determine the underlying field name with
Column.Field.FieldName.
Use this field name to reformat your TQuery's SQL so that you
include an "ORDER BY" clause based on the clicked field, and
refresh the results.
--
jc
Remove the -not from email
 

Re:Sorting tables (Excel like)

Bill Todd <XXXX@XXXXX.COM>writes:
Quote
It is very difficult to answer database questions when you do not tell
us what database you are using or which data access components you are
using. A generic solution is to use a query component and a SQL SELECT
statement with an ORDER BY clause to display the data.
If it is practical to move the data into a ClientDataSet,
you could get this functionality with John Kaster's
TClientDataSetGrid component, available at
codecentral.borland.com/
Rick Carter
XXXX@XXXXX.COM
Chair, Paradox/Delphi SIG, Cincinnati PC Users Group