DBGRID标题排序上放↑


 

procedure TF_StockReport.FlatDBGrid1TitleClick(Column: TColumn);
var
  TheTitleName:string;
begin
  if DM.GoodsInfo.IsEmpty then Exit;
  TheTitleName:=Column.Title.Caption;
  if Pos('↑',TheTitleName)>0 then  begin
     DM.GoodsInfo.SQL.Clear;
     DM.GoodsInfo.SQL.Add('Select * From 商品信息 Order By '+StringReplace(TheTitleName,'↑','',[rfReplaceAll]));
     DM.GoodsInfo.Open;
     Column.Title.Caption:=StringReplace(Column.Title.Caption,'↑','↓',[rfReplaceAll]);
  end;
  if Pos('↓',TheTitleName)>0 then  begin
     DM.GoodsInfo.SQL.Clear;
     DM.GoodsInfo.SQL.Add('Select * From 商品信息 Order By '+StringReplace(TheTitleName,'↓','',[rfReplaceAll])+' DESC');
     DM.GoodsInfo.Open;
     Column.Title.Caption:=StringReplace(Column.Title.Caption,'↓','↑',[rfReplaceAll]);
  end;
end;
------------------------------------------------------------------------------------

相关文章:

  • 2021-11-11
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2021-09-09
  • 2021-06-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
相关资源
相似解决方案