Hi i have 2 form, in the first have a DBTableControl and in the second i have a editing form of a selected record in the 1 form called as :
Procedure AfterShowModal(AValue: TModalResult);
Begin
I'm trying to refresh a DBTableControl here, but how ?
TXDataWebDataSet.Close();
TXDataWebDataSet.Load(); / open ???
DBTableControl.refresh ????
TXDataWebClient.List('ALIQ_IVA', '$filter=(Cod_IVA > 0)', @OnSuccess); ???
i tryed all but no success !!!!
its possible to update only a selected record ?
End;
Begin
TfrmAliqIVA_IE.CreateForm(RecordId);
frmAliqIVA_IE.ShowModal(@AfterShowModal);
End;
wlandgraf
(Wagner Landgraf)
October 31, 2019, 1:58pm
2
To refresh data from a TXDataWebDataset, calling Close and Load should be enough. Of course you must reference the dataset instance from the form, are you code doing that? Your code here in the post does a reference to the class, which is incorrect, but I suppose that is a pseudo code?
i tryied it but not go ! see this complete code :
procedure TfrmAliqIVA_GR.btNuovoClick(Sender: TObject);
Procedure AfterShowModal(AValue: TModalResult);
Begin
wdAliqIVA.Close();
wdAliqIVA.Load();
End;
begin
TfrmAliqIVA_IE.CreateForm(Nil);
frmAliqIVA_IE.ShowModal(@AfterShowModal );
end;
with F12 in chrome i have :
uncaught {fMessage: "", fHelpContext: 0}
raiseE
@
rtl.js:464
as
@
rtl.js:477
OnLoad
@
XData.Web.Dataset.pju:0
cb
@
rtl.js:217
DoLoad
@
XData.Web.Client.pju:0
LocalSuccess
@
XData.Web.Client.pju:0
LocalSuccess
@
XData.Web.Connection.pju:0
XhrLoad
@
XData.Web.Connection.pju:0
load (async)
More :
procedure TfrmAliqIVA_IE.btSalvaClick(Sender: TObject);
begin
If wdAliqIVA.State In [dsEdit,dsInsert] Then
wdAliqIVA.Post();
wdAliqIVA.ApplyUpdates();
ModalResult:=mrOk; <- without this go fine
end;
This is the code executed in a 2 form : if not close immediately the form after ApplyUpdates(); and close after with the specified button close, go fine ! if immediately not update the grid on first form
wlandgraf
(Wagner Landgraf)
November 1, 2019, 11:53am
5
ApplyUpdates is an asynchronous operation. Try to call ModalResult := mrOk only in the AfterApplyUpdates event of the dataset.