Automatically activate the "edit" mode on page load (Interactive Grid Cheat #1)




In this series we want to list tiny useful tricks and tips for the Oracle APEX Interactive Grid one by one. Just a few additional lines of CSS or JavaScript code can quickly provide solutions, so that the grid can be customized in a user-friendly way.


Let's start with the first tip :-)


#1 Automatically activate the "edit" mode on page load

A customer asked us why he always has to switch to "edit" mode in the grid first. It is inconvenient to click first in a cell and then activate the edit mode either by clicking the "edit" button or by clicking again. With one extra line of JavaScript code we can solve the problem ;-)

First, we assign a static-id to the Interactive Grid, so that we can address it via JavaScript without any problems. In our example this is "my_ig". 

Then we create a Page Load Dynamic Action with a True condition that executes a JavaScript code. Enter the following line in the code editor:

apex.region("my_ig").call("getActions").set("edit"true);

Since we don't need the "edit" button anymore, we can hide it with another line. 
To do this, add the following line in the code editor:

apex.region("my_ig").call("getActions").hide("edit");




And here is the link for the demo app.


We hope the tips and tricks will help you. If you have any questions or suggestions, please leave us a comment ;-)






Quellen:

Comments

  1. This only seems to work with the first region on the screen. If you have a master-detail screen with two regions only the master becomes editable whereas the child remains in non-edit mode (even though the Edit button has disappeared).

    ReplyDelete

Post a Comment