Apologies if this is an ignorant question, but I want my call to the API to fetch all pages automatically, without extra user action.
I started with the sample code
base('allocations').select({
// Selecting the first 3 records in Main View:
maxRecords: 3,
view: "Main View"
}).eachPage(function page(records, fetchNextPage) {
// This function (`page`) will get called for each page of records.
records.forEach(function(record) {
console.log('Retrieved ', record.get('ID'));
});
// To fetch the next page of records, call `fetchNextPage`.
// If there are more records, `page` will get called again.
// If there are no more records, `done` will get called.
fetchNextPage();
}, function done(error) {
if (error) {
console.log(error);
}
});
The code appears to call fetchNextPage() after each page of results, which i expect will then call page() again. This does not happen; the next page is not fetched. What am I missing?
Thanks,