Advertisement
Guest User

Gmail Addon Multiple Sections

a guest
Nov 13th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function buildAddOn(e) {
  2.  
  3.   var tempsections = [];
  4.   for (var i =0 ; i<15; i++) {
  5.     var tempsection = CardService.newCardSection().setHeader('Texts '+ i + 'aaaa.');
  6.     tempsection.addWidget(CardService.newTextButton().setText("Sections num"+i).setOnClickAction(CardService.newAction().setFunctionName("test")));
  7.     tempsections.push(tempsection);
  8.   }
  9.  
  10.   // Build the main card after adding the section.
  11.   var card = CardService.newCardBuilder()
  12.     .setHeader(CardService.newCardHeader()
  13.     .setTitle('Quick Label')
  14.     .setImageUrl('https://www.gstatic.com/images/icons/material/system/1x/label_googblue_48dp.png'))
  15.     .addSection(tempsections[0])
  16.     .addSection(tempsections[1])
  17.     .addSection(tempsections[2])
  18.     .addSection(tempsections[3])
  19.     .addSection(tempsections[4])
  20.     .addSection(tempsections[5])
  21.     .addSection(tempsections[6])
  22.     .addSection(tempsections[7])
  23.     .addSection(tempsections[8])
  24.     .addSection(tempsections[9])
  25.     .addSection(tempsections[10])
  26.     .addSection(tempsections[11])
  27.     .addSection(tempsections[12])
  28.     .addSection(tempsections[13])
  29.     .addSection(tempsections[14])
  30.     .build();
  31.  
  32.   return [card];
  33. }
  34.  
  35. function test() {
  36.   return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement