二、dbgrideh标题排序:
首先把需要排序的title.titlebutton:=true
ehlib的optioneh中autosortmarking最好设为true
titelbutton事件中写:
var
sortstring:string;
begin
//进行排序
with Column do
begin
if FieldName = '' then Exit;
case Title.SortMarker of
smNoneEh:
begin
Title.SortMarker := smDownEh;
sortstring := Column.FieldName + ' ASC';
end;
smDownEh:sortstring:= Column.FieldName + ' ASC';
smUpEh:sortstring:=Column.FieldName + ' DESC';
end;
//数据集排序。
try
dataset.Sort:=sortstring //dataset为实际数据集变量名
except
end;
本文来自博客园,作者:del88,转载请注明原文链接:https://www.cnblogs.com/del88/archive/2011/12/29/2306570.html