二、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;

posted on 2011-12-29 19:16  del88  阅读(11)  评论(0编辑  收藏  举报