TineO
TineO

Reputation: 1033

Interactive grid collapsed control breaks

I have a pretty complicated Oracle Apex 19.2 application where on one page we have an IG with up to a couple thousand records. Unfortunately, in order to allow users to insert the data they want, I have to reload the site on every change of a certain type so that they don't mess up the data.

But because the users need to insert quite a bit of this data they want control breaks so that they can collapse the sections they have already completed. Normally these closed control breaks would open back up on every refresh, but I cobbled together some abomination that runs through the IG in javascript before submit and stores which control breaks are closed. And then there is a DA on page load that checks these stored breaks and goes through the IG and tries to close the control breaks.

This works surprisingly well, as long as you don't have many records. Because, well, APEX tries to optimise things and only loads some of the rows from the start, then loads more as you scroll down.

Now that I have explained the background:

Is there any way of forcing an interactive grid to load all its rows from the start, even if it takes a bit longer?

Or perhaps do you brilliant people have a better idea how to restore those collapsed control breaks?

Thank you for any ideas you may have.

Upvotes: 1

Views: 1581

Answers (1)

Damian
Damian

Reputation: 211

In order to fetch all records to your IG region, you need to use IG JavaScript API method model.fetchAll().

  1. Set static ID for your IG region (Advanced > Statid ID), e.g. igRegionId.

  2. Create new Page Load dynamic action.

  3. Add a TRUE action of type Execute JavaScript Code to dynamic action.

  4. Put sample JavaScript code to Setting > Code attribute of your TRUE action.

    let ig = apex.region("igRegionId").widget().interactiveGrid("getViews","grid"); ig.model.fetchAll(function(response){ console.log(response); });

fetchAll gets rows from database chunked by pageSize (default 50 records). In response callback parameter is object with info about data offset, total records and is fetching is done.

Upvotes: 1

Related Questions