How to update a single Record in a Record List using Ajax

How to update a single Record in a Record List using Ajax

Hi everyone!

I wanted to update only one row in a Record List from a popup editor using Ajax in SS To test my approach, I did the following example: 

I've defined the Save button as follows:

But it didn't work.

Anybody knows what’s wrong in this procedure?

To solve this problem I did a workaround converting the updated record to xml format and sending it by message to the OnNotifyEdit and than rebuild it and assign it to the Record List. I know it is also possible to send only the id of the updated record to OnNotifyEdit but In that case I would be forced to do a new query to get the record from db.

Best Regards

Hi Paulo,

In your question you mean "Updating a sigle record from a TableRecords list" right?

First of all, it was not clear to me what you were trying to optimize here:
  1. Are you worried about Querying the database again due to performance issues? Is querying the database that second time out of question for you? Why is that?
  2. Are you worried about refreshing the full table because you think it's bad for the end-user to have a full table refresh? 
Anyway, from a develoment perspective, converting to XML is a huge overkill. In my humble oppinion here's how you should do it:
  • Do your update inside the Popup/Save, notify and close.
  • In the parent page (OnNotify action), refresh your query and do an Ajax Refresh on the table.
  • If you really need to update that single row, maybe you can add an input parameter to the Popup and set it with the current Row Number. Then, return it back with the Popup_Editor_Notify event to the parent and use it to set the "RowNumber" property of the "Ajax Refresh" for the table.

Hi Mario,
Thanks for your help. In fact the problem is already solved according to your suggestions. I wasn’t sure if that approach is correct but I'm now convinced!I was trying to minimize the number of query to improve the performance. Since then, I learned a lot about performance in Outsystems.
Thanks again,
Paulo Moreira Mendes