A
AK-clj
Unregistered / Unconfirmed
GUEST, unregistred user!
我想做一个这样的功能,通过鼠标选取几个单元格后,一起修改它们的值。
问题代码如下:
var
i,j:integer;
UpValouble;
InputVal:string;
begin
if (btv_DPSetting.DataController.GetSelectedCount>0) then
begin
InputVal:=InputBox('输入框','请输入上调幅度(必须是数字值):','0');
if (TryStrToFloat(InputVal,UpVal)) then
begin
btv_DPSetting.DataController.begin
Update;
for i :=0 to btv_DPSetting.Controller.SelectedRowCount-1do
begin
for j :=0 to btv_DPSetting.ColumnCount-1 do
begin
if btv_DPSetting.Columns[j].Selected
And checkEdtType(btv_DPSetting.Columns[j].DataBinding.ValueType) then
begin
btv_DPSetting.DataController.Controller.SelectedRecords.Values[j]:=
btv_DPSetting.DataController.Controller.SelectedRecords.Values[j]+UpVal;
end;
//if
end;
//for
end;
//for
btv_DPSetting.DataController.EndUpdate;
end;
end;
//if
这个代码知道只能实现修改表面显示的值,在POST后无法保存到数据库中。
麻烦大家帮帮忙!
问题代码如下:
var
i,j:integer;
UpValouble;
InputVal:string;
begin
if (btv_DPSetting.DataController.GetSelectedCount>0) then
begin
InputVal:=InputBox('输入框','请输入上调幅度(必须是数字值):','0');
if (TryStrToFloat(InputVal,UpVal)) then
begin
btv_DPSetting.DataController.begin
Update;
for i :=0 to btv_DPSetting.Controller.SelectedRowCount-1do
begin
for j :=0 to btv_DPSetting.ColumnCount-1 do
begin
if btv_DPSetting.Columns[j].Selected
And checkEdtType(btv_DPSetting.Columns[j].DataBinding.ValueType) then
begin
btv_DPSetting.DataController.Controller.SelectedRecords.Values[j]:=
btv_DPSetting.DataController.Controller.SelectedRecords.Values[j]+UpVal;
end;
//if
end;
//for
end;
//for
btv_DPSetting.DataController.EndUpdate;
end;
end;
//if
这个代码知道只能实现修改表面显示的值,在POST后无法保存到数据库中。
麻烦大家帮帮忙!