0

I have "Calculated" model called "Groups" in which I have added the following server script to load the google groups that are part of my domain and display them in a table widget when the user lands on the page. The data displays fine on the first page, but when I click to see the next page, I see the same subset of records and clicking the headers to sort the table does not work either. I'd appreciate some guidance here.

Calculated Model Server script:

var groupList = [];  
var pageToken;
 var page;
  do {
    page = AdminDirectory.Groups.list({
      customer: 'my_customer',
      maxResults: 5,
      pageToken: pageToken
    });

    var groups = page.groups;
    if (groups) {
      for (var i = 0; i < groups.length; i++) {
        var group = groups[i];
        var record = app.models.Groups.newRecord();
        
        record.id = group.id;
        record.name = group.name;
        record.email = group.email;
        record.directMembersCount = group.directMembersCount;
        
        groupList.push(record);
               
      }
    } else {
      console.log('No groups found.');
    }
    pageToken = page.nextPageToken;
    } while (pageToken);
return groupList;

I've configured the model the following way: enter image description here

jorgeAChacon
  • 319
  • 2
  • 5
  • 21
  • Pagination on calculated models isn't currently working as expected. You can check out the answer here for one way to get around it: https://stackoverflow.com/a/53288970/10176600 – The Support Group Nov 15 '18 at 21:52
  • Thank you for the prompt response @TheSupportGroup and for the suggestion. I will take a look and implement. – jorgeAChacon Nov 16 '18 at 14:38

0 Answers0