Search code examples
javascriptjqueryoracle-apex

How to fetch all the records in some column in interactive grid Oracle APEX (without using forEach)?


How do I fetch all the records in some column in interactive grid in Oracle APEX (without using forEach)? For example, I have a grid with columns: first name, last name, age, etc... I want to fetch all the ages and check for duplicates using JavaScript or jQuery by using for (NOT forEach) loop...

Thanks!


Solution

  • let age = [];
    let model = apex.region(<staticId>).widget().interactiveGrid('getViews').grid.model;
    let totalRecords = model.getTotalRecords(true);
    for (let index = 0; index < totalRecords; index++) 
    {
      let record = model.recordAt(index);
      if (record)
      {
          age[index] = model.getValue(record, "AGE");
      }
    }