Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Tiago Baptista
11
Views
9
Comments
Edit an Edit Record with Ajax!
Question
Hello,
Some days ago I wanted to edit an edit record with ajax and I found out that something did not work as I expected, so I asked my junior colleague to develop this small eSpace as a sample. It contains two screens which are exactly the same with a small difference, where at the top there's an edit record and under it a table records. We can create, edit and delete some data. It's a simple and standard screen.
The difference between these two screens is in the edit action which uses ajax. The first screen affects the query result to the edit record directly and it works. The second one, assigns it to a record variable which will fill the source record of the edit record, that is, the standard way of editing an edit record. It doens't work!
Can anybody explain me why? Is it an error? Or the expected behaviour?
Thanks.
Tiago
TesteJM2.oml
Eric Oud Ammerveld
Hi Tiago,
Your Junior hasn't set the source record in your Screen 1.
Besides that, in the "
Editar
" of Screen 1 you set ER_Empregado.record.
That's unneeded if you set the sourcerecord directly to the
GetEmpregado.
I didn't test it; but I guess that should work.
Tiago Baptista
Hi Eric,
You should have tested. Because Screen 1 works and Screen 2 doesn't! ;) If you click the "editar" (edit) button, it works in Screen1 and it doesn't in Screen2.
This is what I want, that is, someone who can explain me this behaviour.
Tiago
Eric Oud Ammerveld
Hmm ok; now with testing; the screen record doesn't seem to get updated.
(I guess it's best to report this to support as a bug for it seems to be one)
In the first screen you're actually updating the screen record directly.
In the second screen you're using a local array to do this.
The binding of the local array with the screenrecord seems to fail somehow (not sure why).
As a workaround you can either:
- Use this Assign in the Editar Screenaction (instead of the existing one):
ER_Empregado
.
Record = GetEmpregado
.
List
.
Current
- Change the input variable of the Editscreen:
Empregado_Nome
to
rlEmpregados
.
Current
.
Empregado
.
Nome instead of ER_Empregado
.
Record
.
Empregado
.
Nome
and
Empregado_CodEmpregado
to rEmpregado
.
Empregado
.
CodEmpregado instead of ER_Empregado
.
Record
.
Empregado
.
CodEmpregad
Daniel Lourenço
Staff
Hi Tiago,
I noticed you are ending your Ajax actions with a "goto screen" node instead of an "End" node.
This means that your actions are not doing a post-back (maintaining the status of the screen) but a full reload of your screen.
Could this be the reason? (see the screenshot below).
If not, can you clearly describe what you mean by "working" and "not working"? Which is the mis-behavior that you are experiencing?
Kind Regards,
Daniel Lourenço
OutSystems
Tiago Baptista
Hi Daniel,
Thanks for your answer.
If you read carefully what I've wrote, you will understand like Eric did, that the problem is in the edit action (editar), not in the save action (guardar). I didn't mention it. Not all the actions end with a navigation screen. The edit action uses ajax and finishes with an end.
If you test Screen1 and Screen2, by editing some data, you will understand the problem, if it is a problem or error or something that I'm curious to understand.
Thanks again.
Tiago
Daniel Lourenço
Staff
Hi Tiago,
Thank you for the extra-information.
The
EditRecord
widget does not execute a "rebind" to the
Source Record
in Post-Backs. In fact, the
EditRecord.Record
variable is a copy of the
Source Record
specified, and this copy is only done when the screen loads.
This is the expected (and desirable) behavior because this way you are sure that all the information input by the user in the Edit Record fields is never lost. If you want to change the information displayed int the
EditRecord
after a post-back, all you have to do is affect the
EditRecord.Record
variable directly (as you did in the second screen).
I hope this information helps.
Kind Regards,
Daniel Lourenço
OutSystems
Ricardo Araújo
Tiago
just adding a word on what Daniel just said, you can always do a debug adding the Editrecord to watches and do a break point in the screen to see the values that the
EditRecord.Record
is having at the moment.
So to fix your problem in the assign node at Editar function just Assign to
EditRecord.Record
the
rEmpregado
value.
RNA
Tiago Bernardo
Champion
Hello.
Seems to me this information supplied by Daniel Lourenço is very important.
https://www.outsystems.com/forums/discussion/6317/edit-an-edit-record-with-ajax/#Post16398
Tried to find it on the outsystems help but with no results.
I really think this should be mentioned, perhaps as an Important Note, may be here:
https://www.outsystems.com/help/servicestudio/9.0/default.htm#Designing_Actions/Create_the_Screen_Preparation.htm
Cheers.
Daniel Lourenço
Staff
Thank you for your feedback, Tiago! I'll forward to our documentation team for their analysis.
Kind Regards,
Daniel Lourenço
OutSystems
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
 Loading...