2 Replies Latest reply on Mar 14, 2019 7:26 PM by InoL

    getActiveRecord bug in Apex 18.2 (and 19.1 EA)?


      I tried this in the Chrome console:


      var grid = apex.region("mygrid").widget().interactiveGrid("getViews", "grid");



      Uncaught TypeError: grid.getActiveRecord is not a function

          at <anonymous>:1:6


      Note: grid.getActiveRecordId() does work (as do many other methods)


      Strange thing is that getActiveRecord is documented, but I didn't find any examples.

      On the other hand, getContextRecord is not documented, and you do find examples on how to use this method.

      However, in my case getContextRecord  doesn't return anything, because I'm not in the context of an IG action.

        • 1. Re: getActiveRecord bug in Apex 18.2 (and 19.1 EA)?
          John Snyders-Oracle


          You may be confusing the view interface with the grid widget.

          In this code:

          var grid = apex.region("mygrid").widget().interactiveGrid("getViews", "grid");

          The variable grid is a reference to the view interface for the grid view of the interactive grid. The view interface was never documented. There is a sketch (meaning not complete) of it planned for the 19.1 JavaScript API doc.

          So when you see sample code doing something like:

          var model = apex.region("mygrid").widget().interactiveGrid("getViews", "grid").model;

          That was never documented or officially supported but clearly needed in order to work with IG. In 19.1 the model property and a few others will finally be documented.


          The view interface does have a getActiveRecordId method but it is still undocumented and always has been.


          The view interface does have a view$ property that you can use to call methods on the associated view widget.


          So in your example above what you probably intended to do is:





          • 2. Re: getActiveRecord bug in Apex 18.2 (and 19.1 EA)?

            Thanks John, that works.


            I already ended up using this: grid.model.getRecord(grid.getActiveRecordId());