DBGRIDEH Implementation Click Title Bar Square to Select BLOG in Snowfall

xiaoxiao2021-03-05  63

1. Add reference: dbclient

2. Set the DBGRIDEH control properties:

Set the DGHAUTOSORTMARKING attribute to true

Set the TitleButton property of the desired sorting column is true

3.// Table Sort Procedure ORDERGRID (DataSet: TclientDataSet; Orderfield: String);

VAR

i: integer;

Begin

If DataSet.indexfieldNames <> '' THEN

Begin

I: = TclientDataSet (Dataset) .indexdefs.indexof ('i' orderfield);

IF i = -1 Then

Begin

with dataset.indexdefs.addindexdef do

Begin

Name: = 'i' orderfield;

Fields: = ORDERFIELD;

DESCFIELDS: = Orderfield;

END;

END;

DataSet.indexfieldNames: = '';

DataSet.indexName: = 'i' ORDERFIELD;

end

Else

Begin

Dataset.indexName: = '';

DataSet.indexfieldNames: = Orderfield;

END;

END;

4. Tune in the Ontitleclick event in DBGRIDEH

OrderGrid (DM.ClientDataSet, Column.fieldName);

转载请注明原文地址:https://www.9cbs.com/read-31757.html

New Post(0)