zoukankan      html  css  js  c++  java
  • 双击dbgrid排序的问题

    有关双击dbgrid排序的问题(想让用户双击dbgird控件的某一个字段时就升序,再双击就降序....?)【DFW:DouZheng】procedure TForm1.DBGrid1TitleClick(Column: TColumn);
    var
    temp, title: string;
    begin
    temp := Column.FieldName;
    qusp.Close;
    if Column.Index <> lastcolumn then
    begin
      if (Pos('↑', DBGrid1.Columns[LastColumn].Title.Caption) > 0) or (Pos('↓', DBGrid1.Columns[LastColumn].Title.Caption) > 0) then
        DBGrid1.Columns[LastColumn].Title.Caption := Copy(DBGrid1.Columns[LastColumn].Title.Caption, 3, Length(DBGrid1.Columns[LastColumn].Title.Caption) - 2);
      qusp.Sql[icount] := 'order by ' + temp + ' asc';
      DBGrid1.Columns[Column.Index].Title.Caption := '↑' + DBGrid1.Columns[Column.Index].Title.Caption;
      lastcolumn := column.Index;
    end
    else
    begin
      LastColumn := Column.Index;
      title := DBGrid1.Columns[LastColumn].Title.Caption;
      if Pos('↑', title) > 0 then
      begin
        qusp.Sql[icount] := 'order by ' + temp + ' desc';
        Delete(title, 1, 2);
        DBGrid1.Columns[LastColumn].Title.Caption := '↓' + title;
      end
      else if Pos('↓', title) > 0 then
      begin
        qusp.Sql[icount] := 'order by ' + temp + ' asc';
        Delete(title, 1, 2);
        DBGrid1.Columns[LastColumn].Title.Caption := '↑' + title;
      end
      else
      begin
        qusp.Sql[icount] := 'order by ' + temp + ' asc';
        DBGrid1.Columns[LastColumn].Title.Caption := '↑' + title;
      end;
    end;
    qusp.Open;
    end;

  • 相关阅读:
    Discuz利用百度ping把我们网站自动提交到百度
    正则表达式速查表1
    thinkphp 新浪新闻采集代码演示
    php采集一网站的精美图片
    百度知道的php爬虫
    新浪新闻采集程序
    mysql pid文件丢失解决办法
    js位运算-按位非
    mysql表损坏解决方案
    h5新API之WebStorage解决页面数据通信问题
  • 原文地址:https://www.cnblogs.com/martian6125/p/9631541.html
Copyright © 2011-2022 走看看