Retriving DynEdit value

Hello!

In TIWDBAdvWebGrid I show database table, one of fields is "Comment" field wich sometimes needs to be changed (with editing i don't want to change it on database) then report is generated and change can vanish away and show database value again.

So i tried to make it editable:

procedure TIWFormMain.TIWDBAdvWebGridMeasListGetCellType(Sender: TObject;
  RowIndex, ColumnIndex: Integer; var AColumnType: TTIWColumnType;
  var Editor: TTIWColumnEditor; var DynEditor: TTIWDynEditType);
begin
  if ColumnIndex = GetColumnIndex(TIWDBAdvWebGridMeasList,'Comment') then
  begin
    AColumnType:=ctDynEdit;
    DynEditor:=deText;
    Editor:=edEdit;
  end;
end;

So now the table show values of "Comment" retrived from DB and i can still edit it.
How can i retrive that value?
I found in manual that only after submit value can be retrived and I tested it:

 TIWDBAdvWebGridMeasList.DynEdits[1,1]:='1234';
  IWLabel1.Caption:=TIWDBAdvWebGridMeasList.DynEdits[1,1];

IWLabela1 got the '1234' value.
My question is how can i submit changes that user typed in edit so that i can retrive ti when i generate report?



Hi,


The "submit" that is mentioned in the TMS IntraWeb Grids PDF manual refers to triggering a page refresh. For example, you can use the OnClick event of a TIWButton control to perform a submit.
In the OnClick event you can retrieve the updated value of the ctDynEdit column through DynEdits[].

I must be doing something wrong. After i submit:

procedure TIWFormMain.IWButton1Click(Sender: TObject);
begin
 IWLabel1.Caption:=TIWDBAdvWebGridMeasList.DynEdits[GetColumnIndex(TIWDBAdvWebGridMeasList,'comment'),1];
end;

dynedit is cleared of value i typed in and IWLabel1.caption is empty.

I use Intraweb 14.0.36  with Delphi XE5 and TMS IntraWeb Component Pack Pro release October 2014 : Version 5.6.0.1

Can you pleas make me an exsample, perhaps just one column with dynedit type in value and on button press show thjat value in label. I vould appriciate it much.

Unfortunately it's currently not supported to retrieve the updated value of a ctDynEdit cell if the ColumnType is set through the GetCellType event.


As an alternative (if you are changing the ColumnType for all rows, like in your sample code) you can directly change the Columns[].ColumnType property to ctDynEdit during a page refresh.

We will investigate if the functionality of using DynEdits[] can be extended to the GetCellType event in a future version of the TIWDBAdvWebGrid.

Even better! Works as expected!
Many thanks