Forum Stats

  • 3,837,795 Users
  • 2,262,300 Discussions
  • 7,900,394 Comments

Discussions

Return Cell Value on Click on Interactive Grid Cell

SteveQuinlivan
SteveQuinlivan Member Posts: 68 Red Ribbon

Afternoon,

I was wondering if someone can help with the below.

I have an Interactive Grid (See Below), and i want the user to be able to click on a specific RAG value, and that populate the associated value from the Required Country column (same row as the rag that was clicked on), into a hidden field on my page.

i.e. Click on he RAG icon on the Anoc row, and Anoc value is stored in the hidden field.

The RAG column is already a HTML Expression type.

Ill use the value from the hidden field item to drive a pop up form to show the detail behind the rag for that country

As always any help appreciated.

I'm using Version 19.2

Regards

Tagged:

Best Answer

  • Hamza Al-abbasi
    Hamza Al-abbasi Member Posts: 595 Gold Trophy
    Answer ✓

    Hi SteveQuinlivan,

    • Give your IG a static id e.g. "emp"
    • In your HTML column add a data-action to get for example EMPNO value (my data-action is "get-empno"):
    <button type="button" class="a-Button a-Button--noLabel a-Button--iconTextButton js-actionButton" data-action="get-empno">
      <span class="fa fa-trash-o"></span>
    </button>
    
    • In IG JavaScript Initialization Code attribute (replace EMPNO with your column name) :
    function(config) {
    
      config.initActions = function(actions) {
        actions.add({
          name: "get-empno",
          labelKey: "Get Empno",
          action: function(event, element) {
            var view = view = apex.region("emp").call("getCurrentView"),
                model = view.model,
                empnoKey = model.getFieldKey('EMPNO'),
                empno = view.getContextRecord(element)[0][empnoKey];
    
            $s('P24_EMPNO', empno);
          }
        });
      }
    
      return config;
    }
    

    The P24_EMPNO is the item that holds the EMPNO value.

    I have demonstrate an example in my workspace :

    Workspace: hamzasoft

    Username/Password: demo/demo000

    Application 62472 - Page 24

Answers

  • Hamza Al-abbasi
    Hamza Al-abbasi Member Posts: 595 Gold Trophy
    Answer ✓

    Hi SteveQuinlivan,

    • Give your IG a static id e.g. "emp"
    • In your HTML column add a data-action to get for example EMPNO value (my data-action is "get-empno"):
    <button type="button" class="a-Button a-Button--noLabel a-Button--iconTextButton js-actionButton" data-action="get-empno">
      <span class="fa fa-trash-o"></span>
    </button>
    
    • In IG JavaScript Initialization Code attribute (replace EMPNO with your column name) :
    function(config) {
    
      config.initActions = function(actions) {
        actions.add({
          name: "get-empno",
          labelKey: "Get Empno",
          action: function(event, element) {
            var view = view = apex.region("emp").call("getCurrentView"),
                model = view.model,
                empnoKey = model.getFieldKey('EMPNO'),
                empno = view.getContextRecord(element)[0][empnoKey];
    
            $s('P24_EMPNO', empno);
          }
        });
      }
    
      return config;
    }
    

    The P24_EMPNO is the item that holds the EMPNO value.

    I have demonstrate an example in my workspace :

    Workspace: hamzasoft

    Username/Password: demo/demo000

    Application 62472 - Page 24