Hi!

I have a lost data problem when I use a list of editable table:

I have a page with a list, and every element of this list is a webblock with editable table inside. 

page:


webblock with editable table:

When I edit a row in editable table, I'm notifying the data of the row to outside of webblock and adding this data to a data list in page

notifying editable table data changed:

page recive the notification and data is added to page data list:


But when the screen action that receive the notify (and add the data to a list) ends, the list in the page is empty; for example, if I put a save button in page (or add another row in editable table) when I debug that, data in page has been lost:


If I change the editable table inside webblock for an inputs (the same inputs that had the editable table), and notify with an ajax button event, the data IS NOT LOST. Same sequence.

inputs instead editable table:

It's working fine:


So I think something is wrong with editable table. Anybody knows why?

Hello,

would it be possible for you to share a sample module where we can see this behavior?

Thanks,

Andres Moreno

Sure!

There is two screens, with same code, the only difference is the webblock used (with editable table, or with list and inputs).

I've attached. Is in Outsystems 10, so if you has OS11 you should convert (and maybe some incompatible dependences will appear)


Regards,
Carlos

Carlos,

I was able to see your issue. 

In order to get the result when I press the Save button I added an Ajax Refresh on the "OnNotify" screen action (see picture below)

This should make it work in your situation.

On thing I don't understand is why you would want that EditableTable within a webblock, at this moment it does not look like it has a lot of complex logic to have to add this layer of complexity in order to make it reusable, but then again I don't know if there is going to be a lot more logic in the Save.

If there is going to be a lot more logic, I would still not recommend doing it the way you did and just use the standard functionality for the Editable Table and create a Server Action for the "Save" logic of the Table.

I hope this resolves your issue.

Andres Moreno

Hello Carlos,

What is happening (IMHO), is that when you use the Editable Table in the Web Block, the platform is not able to recognize that the list (inside the list) will be used, and is just optimizing your code ignoring anything that uses it, not saving the changes to the page's ViewState. 

The ajax refresh seems to "fix" it...

I'll ask OutSystems about this. 

In any case, I strongly recommend avoiding using EditableTable in any complex situation (like the one you are using). EditableTables are know to work well in simple uses (simple list page), and have lots of problems in more tricky use cases.

Cheers.

Hi Andres!

First of all, thanlks for help! 

The answer solve partialy the problem, but really it's a "trick" to get around the problem: why is the data lost with editable table save notify? And doesn't work propertly if you press tab button to "save row and create new one". I could disable tab button, but this don't solves the problem behind... Could be some edtiable table bug, or do you think there is an explanation to work this way?

Talking about the application, the shared one is a simplified case of my real application: I have a lot of logic behin, a list of weblocks that in some cases have a editable tables, and a "save button" in page, so I only need save data full data when click this button and not in every row of the editable tables list...


Regards,
Carlos.


Either way, since you are updating the Variable that contains the list, you need to Ajax Refresh that component to let the UI know about the changes.

An OutSystems support person might have a better answer for that.

My first thought was that since the Variable is bound to that List Record an Ajax Refresh would take care of having all the data in sync.

I know it's not a real answer, since there is probably a lot more behind this.

Hi Eduardo!

The strangest thing is that, if I change the editable table for a list of  inputs (a list of weblocks, and inside each weblock I place a list of inputs, so, in essence, is the same of editable table), works right, and if I change for an editable table, it doesn't. 

I have a "dirty trick" to make it work, that is not use the "onrowsave" of editable table (that seems not work) to notify outside the weblock; instead of that, I have placed in "onrowsave" event, an "onclick" action on a link, and this link execute an action that is the one to throw the on notify events.

OnRowSave event, that execute onclick over link

link that throws the Onnotify event


Is like the OnRowSave event of editable table had its own scope, and if you change data of variables inside this action, the data has not really changed, but it's just a guess.

Regards,
Carlos.

Hi Andres!

Again, thanks for answer! 

I really think that it should not be necessary to refresh the whole list as you propose. On the one hand, when the event of the editable table is finished, the editable table it is already refreshed (at the UI), and on the other hand, when notifying the data outside weblock and saving them in the top list, it should have the data. Proof of this is that if instead of using the editable table, I use a list of inputs (the second page test that I have include in oml) it does not need to refresh the list and it works correctly. It seems to be something exclusively from the editable table onrowsave event...

May be I will ask to outsystems support, but anyway thanks a lot for answers.

Thanks,
Carlos.

Hi Carlos,

The hidden link in the web block is set to Submit?

Cheers.

Carlos,

I've been discussing this with some colleagues and we think we have an idea of WHY this is happening, but let me talk to OutSystems first in order to give you a better answer with a more "definitive" answer.

Cheers.

Hi Eduardo!


The hidden link is inside the weblock with the editable table (just followed by the editable table).

I will be aware of what they tell you, so, thanks for help ;)


Carlos.

A quick update: I have reported to Outsystems support, and they are evaualting the issue. Seems to be a bug, and in that case, it should be solved in RQR-1111 bug fix.

Regards,
Carlos.