cxGrid数据录入

cxGrid数据录入

 

一、数据录入

1 在TcxGridDBTableView中,设定属性

  NewItemRow.Visible = True

2 在cxgrid中输入数据怎样回车换行 
  在TcxGridDBTableView中 
  将属性OptionsBehavior.FocusFirstCellOnNewRecord = True 
        OptionsBehavior.GoToNextCellOnEnter = True 
        OptionsBehavior.FocusCellOnCycle = True 
就可以了.

如果愿意也可以添加其自带的操作按钮,OptionsView.Navigator = True

随后在NavigatorButtons属性中做微调。

3 使用TcxGridDBCardView录入时,一些属性不一样,此时除了修改OptionsBehavior中的属性值外,还要修改OptionData.Appending=True,同时要添加其自带的操作按钮,才行。

二、LookUp功能

1 在cxGrid中使用LookUp功能 
  在相应的列(TcxGridDBColumn)中将属性Properties = LookupComboBox 
            Properties.ListSource = 数据源 
            Properties.ListFieldNames = 相应字段 
            Properties.KeyFieldNames = 关键字段 
  也可以修改Properties.ListOptions.ShowHeader,可控制是否显示列头。

来源: http://www.cnblogs.com/zwz_good/archive/2009/05/10/1453563.html

with createColumn do
begin
  Name := 'PayDetail_Id';
  Width := 1;
  HeaderAlignmentHorz := taCenter;
  HeaderAlignmentVert := vaCenter;
  Visible := false;
  tag := 0;
  PropertiesClass := TcxTextEditProperties;
  with TcxTextEditProperties(Properties) do
  begin
     Alignment.Vert := taVCenter;
     ReadOnly := true;
  end;                        
end;

原文地址:https://www.cnblogs.com/karkash/p/3086159.html