1.添加引用:DBClient2.置DBGridEh控件属性: 设置dghAutoSortMarking属性为true 设置希望排序的Column的TitleButton属性为true3.//表格排序过程
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&...[ 查看全文 ]