Tom
Tom

Reputation: 167

send the value of the field from an interactive grid to another page and store it in an item with Javascript and Oracle Apex

I currently save the value of a field of the grid in an item (P5_VALUE),send it to another page (page 6) and store it in an item (P6_VALUE) through a button

Action: Redirect to Page in this application.

Target: Page in this application , Page: 6, set Items: NAME: P5_VALUE, VALUE: P6_VALUE, Action: Reset Pagination. This is the url that is generated: http://ip:port/ords/app/system/page?p5_value=61&clear=RP&session=12518184703789

But now I want to do the same with APEX$ROW_SELECTOR. With this code I have been able to add an action to the grid and get the value of the field but I do not know how to send it to the other page and assign the value to the other item

var view = apex.region("ig-emp").widget().interactiveGrid("getViews", "grid"),
menu$ = view.rowActionMenu$;

menu$.menu("option").items.push({
 type:"action",
 label:"Get Emp No",
 icon: "fa fa-close",
 action: function(menu, element) {
                     var record = view.getContextRecord( element )[0];
                     var val1 = view.model.getValue(record, "EMPNO");
                                 }
 });

Upvotes: 0

Views: 1932

Answers (1)

Akil_Ramesh
Akil_Ramesh

Reputation: 431

Use the below approach to achieve this:

  1. Let me start by adding some more lines to your code.
var view = apex.region("ig-emp").widget().interactiveGrid("getViews", "grid"),
menu$ = view.rowActionMenu$;

menu$.menu("option").items.push({
 type:"action",
 label:"Get Emp No",
 icon: "fa fa-close",
 action: function(menu, element) {
                     var record = view.getContextRecord( element )[0];
                     var val1 = view.model.getValue(record, "EMPNO");
                     apex.page.submit({
                          request:"NAVIGATE",
                          set:{"P1_EMPNO":val1},
                          showWait: true
                     }); 
                                 }
 });

Note: in the above code replace P1_EMPNO with your page item name.'

  1. Create a Branch -> Type: Page or URL(Redirect).
  2. Select the page number to redirect and set the value of the current page item to the new page item. Refer below screen shot for example.

enter image description here

  1. In the Server-side condition, select the Type as Request = Value and provide the value as NAVIGATE. Refer below screen shot.

enter image description here

Upvotes: 1

Related Questions