动态把列绑定属性出错了。。那一列本来是没有Properties的,我是触发某一个事件后就执行下面的语句.但listSource赋值时出错.大家来帮忙看下啊..cxGrid1DBTableView1csr_udf1_nv.PropertiesClassName :='TLookupComboBoxProperties';
with (cxGrid1DBTableView1csr_costcenter_nv.Properties as TcxLookupComboBoxProperties) do begin
ListSource:=Ds_WorkCell; //就是这句出错,不知道什么原因
ListOptions.ShowHeader:=False;
ListFieldNames:='par_descc_nv';
KeyFieldNames:='par_descc_nv';
end;
with (cxGrid1DBTableView1csr_costcenter_nv.Properties as TcxLookupComboBoxProperties) do begin
ListSource:=Ds_WorkCell; //就是这句出错,不知道什么原因
ListOptions.ShowHeader:=False;
ListFieldNames:='par_descc_nv';
KeyFieldNames:='par_descc_nv';
end;
解决方案 »
- 怎样得到桌面上任意一个像素点的颜色
- dll动态调用dll传参数的问题
- 怎么远程调用其他计算机上的程序,分不够再加
- 运行的时候报 the maximum number of application is already ……,是什么问题?
- 求《会计伴侣》的源代码
- with Series1, HeapStatus do//为什么这里有两个东西Series1, HeapStatus
- 在使用IntToHex时出现错误,提示是“This is no overload version of 'IntToHex' that can be called with these argumets',请问是什么意
- TActionMainMenuBar,TActionManager,TActionList用法?
- 关于函数Locate的问题
- 关于delphi中利用IdIcmpClient空间实现ping命令
- 有关delphi几个版本的选择问题
- 急!!!!!!!!
begin
Cxgrid1DBTableView1.ClearItems;
for I:=0 to QryExcut.FieldCount-1 do
begin
Cxgrid1DBTableView1.CreateColumn;
Cxgrid1DBTableView1.Columns[i].DataBinding.FieldName:=QryExcut.Fields[i].FieldName;
end;
//以上是动态画显示cxgrid的内容
Specifies the TDataSource instance containing data to display within a lookup editor.property ListSource: TDataSource;Description
Use the ListSource property to specify the TDataSource instance containing data to display within a lookup editor. Setting this property value is not enough for the lookup editor to display data within the dropdown list. The lookup editor must have at least one column in the ListColumns collection bound to a specific ListSource field. Also you have to specify a key field(s) via the KeyFieldNames property used to identify records within the ListSource. A key field value(s) of a record selected in the dropdown list matches the edit value of an editor and can be accessed via the EditValue property.
The value displayed in the edit region of a lookup combobox is addressed by the ListFieldIndex property.varA:TDataSource:
B:TcxlookupcomboboxProperties;
begin
A:=TDataSource.create(self);
B:=tcxlookupcomboboxproperties.create(self);
A.Dataset:=Dic_ry_xb;//此处指定数据源。
b.listdource:=a;//此处指明字段的listsource属性。
b.keyfieldnames:='a'; //此处指明字段的关键字段
b.listfieldnames:='b'; //此处指明字段的返回值。
b.listcolumns.items[0].caption:='x; //此处默认是会建立一个字段,但是显示的表头是name,所以此处让它显示为自己想要的中午显示。
cxGrid1DBTableView1c1_sex_code.Properties:=b; //此处指明是那个字段。
end; //这个是初始化的代码,
cxGrid1DBTableView1AID.PropertiesClass :=
TcxLookupComboBoxProperties;
with TcxLookupComboBoxProperties(cxGrid1DBTableView1AID.Properties) do
begin
ListSource := datasappraise;
KeyFieldNames := 'AID';
ListFieldNames := 'AID;AItems;Ales';
//;proportion
ListColumns[0].Caption:='编号';
ListColumns[0].FieldName:='AID';
ListColumns[1].Caption:='项目';
ListColumns[1].FieldName:='AItems';
ListColumns[2].Caption:='细则';
ListColumns[2].FieldName:='Ales';
//ListColumns[3].Caption:='比重';
//ListColumns[3].FieldName:='proportion';
end;
cxGrid1DBTableView1AID.DataBinding.FieldName := 'AID';
with (cxGrid1DBTableView1csr_costcenter_nv.Properties as TcxLookupComboBoxProperties) do beginPropertiesClassName :='TLookupComboBoxProperties'里的'TLookupComboBoxProperties'打错了吧,应该是'TcxLookupComboBoxProperties'