DBGRIDEH implementation Click Title Bar Rander

xiaoxiao2021-03-05  47

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-32972.html

New Post(0)