Viscosity's Blog

Saving an Interactive Grid Cell on Change

Written by Alan Quigley | Oct 14, 2022 4:39:01 PM

Have you ever been caught off guard by a co-worker that comes to talk to you about that show that everyone was watching this week and totally forgot to save the changes you made in an Interactive Grid? Doesn’t that just ruin your day? Nothing is worse than rework. Sometimes you want your grid to save your work as soon as you leave the cell. It’s a lot easier than you think to get it working.

First, you need to make sure the grid you are working on is editable.

 

 

You can find that under “Attributes” of the Grid you are working on.   

 

Now, go to the column in that grid you want to save.  Let's create a simple Change Event Dynamic Action.   

 

 

 

So far so good, right?  Pretty simple.  Now we will get a True action setup.  Select “Execute Server-side Code.”  This will be a simple PL/SQL Code call to a package or Procedure.   

 

 

Again, very simple stuff.  Now let’s jump to the procedure.  This is where the magic happens. 

 

 

Let’s get the data from the grid that we are editing.  Lines 8 and 9 will do that.  Then we just update the table based on the ID or the Primary Key of the grid and the value we changed.  It really is that easy.  Now, as we enter data into the grid, we will see the familiar marks that the row has been edited, but upon refresh and checking the table, you will see that the data is there and saved. 

 

 

Wasn’t that simple?  Who needs a save button anymore on a grid?  Your users can now have that chit-chat without worrying about losing work, and isn’t that what we are here for?