Google App Maker: How to add pagination and sorting to a table widget bound to a calculated datasource?

蓝咒 提交于 2019-12-11 17:43:50

问题


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:

来源:https://stackoverflow.com/questions/53305663/google-app-maker-how-to-add-pagination-and-sorting-to-a-table-widget-bound-to-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!