有cxGrid扩展当前日期 [英] Have cxGrid expand current date

查看:169
本文介绍了有cxGrid扩展当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按日期制作了我的网格组(抓住列名称并将其拖到按该列分组)。但是,当显示网格时,所有日期都是关闭的,所以我必须展开它们以查看数据。没关系,但是我想知道是否有可能已经扩展当前日期(所有其他应该保持关闭!),所以我不必单击扩展十字架?

I made my grid group by date (grabbed the column name and dragged it to where it says 'group by that column'). However, when the grid is displayed all the dates are 'closed' so I must expand them to see data. That is OK but I wonder if it is possible to have current date expanded already (all other should remain closed !) so I do not have to click the expand cross?

推荐答案

尝试这个,你可以把代码放在其他事件处理程序中,比如TButton,例如

try this, you can put the code in other event handler like a TButton for example

procedure TForm1.FormCreate(Sender: TObject);
begin
    //aDBTableView1.ViewData.Expand(true);            // this is how to expand all records 
    aDBTableView1.ViewData.Records[YourRecordNumber].Expand(true);   // this is how to expand by a given record
end;

确定尝试以下

procedure TForm1.FormCreate(Sender: TObject);
begin
  with cxGrid1DBTableView1 do
  begin
    DataController.DataSource.DataSet.Locate('YourDateFieldName',DateTimeToStr(Date),
    [loPartialKey]);
    ViewData.Records[DataController.FocusedRowIndex].Expand(True);
  end;
end;

这篇关于有cxGrid扩展当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆