Google App Maker: How to add pagination and sorting to a table widget bound to a calculated datasource?
up vote
0
down vote
favorite
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:
appmaker
add a comment |
up vote
0
down vote
favorite
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:
appmaker
Pagination on calculated models isn't currently working as expected. You can check out the answer here for one way to get around it: stackoverflow.com/a/53288970/10176600
– The Support Group
Nov 15 at 21:52
Thank you for the prompt response @TheSupportGroup and for the suggestion. I will take a look and implement.
– jorgeAChacon
Nov 16 at 14:38
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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:
appmaker
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:
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;
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;
appmaker
appmaker
asked Nov 14 at 17:23
jorgeAChacon
1172314
1172314
Pagination on calculated models isn't currently working as expected. You can check out the answer here for one way to get around it: stackoverflow.com/a/53288970/10176600
– The Support Group
Nov 15 at 21:52
Thank you for the prompt response @TheSupportGroup and for the suggestion. I will take a look and implement.
– jorgeAChacon
Nov 16 at 14:38
add a comment |
Pagination on calculated models isn't currently working as expected. You can check out the answer here for one way to get around it: stackoverflow.com/a/53288970/10176600
– The Support Group
Nov 15 at 21:52
Thank you for the prompt response @TheSupportGroup and for the suggestion. I will take a look and implement.
– jorgeAChacon
Nov 16 at 14:38
Pagination on calculated models isn't currently working as expected. You can check out the answer here for one way to get around it: stackoverflow.com/a/53288970/10176600
– The Support Group
Nov 15 at 21:52
Pagination on calculated models isn't currently working as expected. You can check out the answer here for one way to get around it: stackoverflow.com/a/53288970/10176600
– The Support Group
Nov 15 at 21:52
Thank you for the prompt response @TheSupportGroup and for the suggestion. I will take a look and implement.
– jorgeAChacon
Nov 16 at 14:38
Thank you for the prompt response @TheSupportGroup and for the suggestion. I will take a look and implement.
– jorgeAChacon
Nov 16 at 14:38
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305663%2fgoogle-app-maker-how-to-add-pagination-and-sorting-to-a-table-widget-bound-to-a%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Pagination on calculated models isn't currently working as expected. You can check out the answer here for one way to get around it: stackoverflow.com/a/53288970/10176600
– The Support Group
Nov 15 at 21:52
Thank you for the prompt response @TheSupportGroup and for the suggestion. I will take a look and implement.
– jorgeAChacon
Nov 16 at 14:38