Editable Table - add functionality right before Adding new line

Editable Table - add functionality right before Adding new line

  

When a user clicks in "Add Record" in an Editable Table, is there any way to add some action (validations, etc..) right before the line is actually added to the table?


Hi Nelson,


Take a look at the following post, it might give you some insight on what you can do.

https://www.outsystems.com/forums/discussion/15293/editable-table-add-record-event/


Best regards,

Davide Résio

Davide Résio wrote:

Hi Nelson,


Take a look at the following post, it might give you some insight on what you can do.

https://www.outsystems.com/forums/discussion/15293/editable-table-add-record-event/


Best regards,

Davide Résio

I think this is more complicated that it should be.
You can just add validation logic to the 'OnRowSave' event, similar to how you would do it if you normally want to validate a form for example (see the image). The only difference is that you don't need to do ajax refresh. If the input was not valid, it is not added to the database.


Regards,

Sam


Edit: After re-reading the question and the topic that Résio provided, I realised that I might be doing something different from what is asked. If so, just ignore my post :)

Sam Rijkers wrote:

Davide Résio wrote:

Hi Nelson,


Take a look at the following post, it might give you some insight on what you can do.

https://www.outsystems.com/forums/discussion/15293/editable-table-add-record-event/


Best regards,

Davide Résio

I think this is more complicated that it should be.
You can just add validation logic to the 'OnRowSave' event, similar to how you would do it if you normally want to validate a form for example (see the image). The only difference is that you don't need to do ajax refresh. If the input was not valid, it is not added to the database.


Regards,

Sam

Correct but that only happens after the creation of the new line right?

From what I understood, Nelson's trying to perform some sort of action right after the user clicks the "Add record" button but before the new line is added.


Best regards,

Davide Résio

Yeah, I think you are right indeed. I noticed that a few minutes later and edited my comment after.

Hi All


If you need to start adding hidden HTML elements, and JS to validate the record adding, wouldn't you be better off creating your own "editable table" by using a table records with inputs instead of expressions and custom save/delete buttons where you could add your own validation and add/delete logic?

 

Regards,

    CLSJ

Davide's suggestion works well but it doesn't go all the way to what I need.

I asked this because I'm debugging a problem and wanted to try to catch the moment the problem is happening.

In my Editable Table, each line let's me upload in image or pdf and has a link to show it. When clicked it uses the Web Previewer extension to show a PDF or an iframe widget to show an image in the right side of the Editable table.

If I try to add a new line to the table right after loading the page everything works fine (and it goes to the new action created using Davide's suggestion before adding the line).

If I click the link to show the image/pdf of one of the lines, and after that I try to add a new line, I get the "loading" alert in the lower right side of the screen for around 5 seconds and I have to wait until it stops to be able to continue (and it NEVER goes to the new action created using Davide's suggestion before adding the line).

The first column in the table is a text field with the autocomplete widget. If I double click it, I get another 5 second "loading" alert. After that everything works fine.


The "loading" alert also shows when the image/pdf is loading/showing, so maybe it's trying to load the image/pdf again (although it takes more time "loading" in the Add Record than loading the image/pdf).

All of this works fine if I never click the link to show the image/pdf.


I have put breakpoint in the beginning of all screen actions and it's not going to any of them.

I've attached the Network info from Chrome's Developer Tools regarding the clicking in the Add Record after previewing an image.

5.17s of Request Sent

3.22s of Waiting

2.71s of Content Download

Total : 11.67s

Any ideas?

Solution

Well....this happens because of the WebPreviewer extension I use to show the image.

I've put it showing image and pdf via the Iframe and now it works fine, although it just shows part of the image and scroll bars, but that is another problem...

Solution