Home > Back-end >  Edit cxGrid unbounded data source column (set to ButtonEdit) problem
Edit cxGrid unbounded data source column (set to ButtonEdit) problem

Time:11-10

Each expert, in order to torture the problem over for a few days, using devexpress VCL cxGrid forms, cooperate with UniDAC control database operation,
One column is query column, there is no bound to any field in the table, so it is unable to edit, but actually use need to be able to let the user to see the result of the operation, then set the Properties of the column to ButtonEdit, in ButtonClick event processing, and then return the data,
Efforts for a long time, finally realized some functions:
Procedure TfrmManageInputMaterial_FL. CxGrid1DBTableView1PRODUCTIDPropertiesButtonClick (
Sender: TObject; AButtonIndex: Integer);
Var
FrmMultiCheck: TfrmMultiCheck;
Rowindex colindex: integer;
StrReturnName: string;
The begin
Try
Rowindex:=cxGrid1DBTableView1 DataController. FocusedDataRowIndex;
Colindex:=cxGrid1DBTableView1PRODUCTID. Index;
FrmMultiCheck:=TfrmMultiCheck. Create (application);
If frmMultiCheck. ShowModal=mrOk then
The begin
StrReturnName:=frmMultiCheck. StrReturnName;
Self. QryInput. Edit;
Self. QryInput. FieldByName (' productid '). The Value:=frmMultiCheck. StrReturn;//to save to the actual database column
Self. QryInput. Post;

CxGrid1DBTableView1. The codebehind (categories.aspx.cs). Records [rowindex] Values (colindex) :=strReturnName;//focus on the three lines, to achieve the unbounded column changes
TcxButtonEdit (Sender). EditValue:=strReturnName;
TcxButtonEdit (Sender). PostEditValue;

end;
The finally
FrmMultiCheck. Free;
end;
end;

But the above code is flawed, click on the button, the pop-up window, change the cell's value, everything looks very good, but, but when the mouse to click into the cell, the cell's value back to the original value, cell loses focus, only display for the modified value,
Focus all ok, as long as the mouse to click the cell recovery...

Various heroes, please help!

CodePudding user response:

Data set controls should include the field list, in the question field TField. OnGetText incident, custom Text value is the value of the modified target (you),

CodePudding user response:

Select id, for example, getnamebyid (id) as itemname from dual, itemname field, there is no corresponding to an editable field, I tried, you said...

CodePudding user response:

Can you add a computed field, and then needs the column binding the computed field operation,

CodePudding user response:

The two control does not seem to be calculated fields
  • Related