3 Replies Latest reply on Oct 26, 2018 2:57 PM by John Snyders-Oracle

    Get the filter conditions from an IG

    Jeremy Webb

      Apex 5.1.4

      We have an interactive Grid which we can filter using the column heading filtering. We need to be able to extract the filter that has been applied for use elsewhere. I know for a while it has not been possible in the same way that it can be done in IR.

       

      We have found the following method to do it in Apex 18.1, but this does not work in 5.1.4. Is there a way to do something similar in 5.1.4?

       

      var ig$ = apex.region(‘nominalRollIG’).widget();

      var grid = ig$.interactiveGrid(‘getViews’).grid;

      var view ig$.interactiveGrid(‘getViews’,’grid’);

      var model = view.model;

      var cols = view.modelColumns; //This is an array of all the columns so I can get the column name

      var columid, colName, theOperator, theValue;

       

      var filters = apex.region(‘theIG’).all(‘getFilters’); //Get array containing filters

      for (var f in filters) {

         filColId = filters[f].columnId; //Get the column id for the filtered column

         theOperator = filters[f].operator; //Get the operator that is being used

         theValue = filters[f].value; //Get the value that is being filtered

       

         //Now loop through the columns so we can get the column name that is being filtered

         for (var c in cols) {

            columnid = cols[c].id; //The column id from the columns array

            colName = cols[c].property; //The column name

            if (columnid == filColId) {

               console.log(‘Column = ‘+colName+’, operator = ‘+theOperator+’, value = ‘+theValue);

            }

         }

      }

       

      At the moment we are just writing the filter expressions to the console but we will put these into an item so they can be accessed from PL/SQL and the data records be retrieved.

       

      So is there anyway you can do the above in 5.1.4. When we try we get an error complaining that apex.region('theIG').call is not a function.