title: Oracle/APEX Adding a row to an Interactive Grid with a Dynamic Action
body: <p>Currently using APEX 5.1.4</p>
  
  <p>My goal is to have the user press a button, which triggers a new row to be added to the bottom of the IG. This row would also need to have some default values pre-populated, such as the sequence column I have functioning as a primary key.</p>
  
  <p>Doesn't matter how exactly, but I was considering doing it with Javascript. However, none of the methods I have found online, regarding adding a row with Javascript, work.</p>
  
  <p>Also, I have the header bar of the IG removed, so finding the native Add Row Button probably is not an option.</p>
  
  <p>--EDIT--</p>
  
  <p>I found some Javascript that successfully allows me to add a row, however, it adds the row directly underneath the currently selected row. I do not see any methods to automatically select the last row of the IG, and it still doesn't solve that the row needs to have some dynamic values upon instantiation.</p>
  
  <p>Here is the javascript:</p>
  
  <p>This shows all of the available functions that can be invoked ( with .invoke() ):</p>
  
  <pre><code>apex.region("id-region-emp").widget().interactiveGrid("getActions").list()
  </code></pre>
  
  <p>These following lines both instantiate a new empty row on the IG:</p>
  
  <p>("row-add-row" adds to top of IG, "insert-record" adds underneath currently selected row.)</p>
  
  <pre><code>apex.region("id-region-emp").widget().interactiveGrid("getActions").invoke("row-add-row")
  
  apex.region("id-region-emp").widget().interactiveGrid("getActions").invoke("insert-record")
  </code></pre>