容器绑定Google Apps脚本中的jQuery?

迈尔·诺尔(P. Myer Nore)

当前是否可以在绑定有Google Apps脚本Google Doc或Google Sheet容器中使用jQuery库如果是这样,怎么办?

塞尔萨·萨萨斯

它的工作方式与电子表格中的UiApp完全相同,只需使用

  SpreadsheetApp.getActive().show(HtmlService.createTemplateFromFile('index').evaluate());

并使用您的代码和库创建一个HTML文件。

以下是完整的演示代码,屏幕截图和指向共享示例的链接(仅查看)。

代码:

function onOpen() {
  var menuEntries = [ {name: "datePickerTest", functionName: "datePickerTest"}
                     ];
  SpreadsheetApp.getActiveSpreadsheet().addMenu("test",menuEntries);//
}

function datePickerTest(){
  SpreadsheetApp.getActive().show(HtmlService.createTemplateFromFile('index').evaluate());
}

index.html

<div class="demo" >
<style type="text/css"> .demo { margin: 30px ; color : #AAA ; font-family : arial sans-serif ;font-size : 10pt } 
                            p { color : red ; font-size : 8pt } 
</style>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/themes/base/jquery-ui.css">

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>

<script>

/* French initialisation for the jQuery UI date picker plugin. */
/* Written by Keith Wood (kbwood{at}iinet.com.au),
              Stéphane Nahmani ([email protected]),
              Stéphane Raimbault <[email protected]> */
jQuery(function($){
    $.datepicker.regional['fr'] = {
        closeText: 'Fermer',
        prevText: 'Précédent',
        nextText: 'Suivant',
        currentText: 'Aujourd\'hui',
        monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
        'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
        monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
        'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
        dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
        dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
        dayNamesMin: ['D','L','M','M','J','V','S'],
        weekHeader: 'Sem.',
        dateFormat: 'dd/mm/yyyy',
        firstDay: 1,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''};
    $.datepicker.setDefaults($.datepicker.regional['fr']);
});

</script>

Welcome to some random page

<p>Please select a date below :</p>

click here : <input type="text" name="date" id="datepicker" />
<input type="text" id="alternate" size="30">

<script>
    $( "#datepicker" ).datepicker({
      altField: "#alternate",
      altFormat: "DD, d MM, yy",
      showWeek: false,
      firstDay: 1,
      changeMonth: true, 
      changeYear: true, 
      dateFormat: 'dd-mm-yy',
      Locale : 'fr'
    });
</script>

</div>

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

容器绑定Google Apps脚本中的jQuery?

来自分类Dev

Google Apps脚本-如何发布/安装容器绑定脚本

来自分类Dev

无法使jQuery警报在Google Apps脚本中工作

来自分类Dev

当Google表格指向多个容器时,如何删除容器绑定的脚本?

来自分类Dev

带有Google Apps脚本的JQuery Mobile

来自分类Dev

Google Apps脚本:jQuery无法正常工作

来自分类Dev

Google Apps 脚本中的 Google Drive 通知

来自分类Dev

无法将端口绑定到我在Google Container优化的VM中的容器

来自分类Dev

无法将端口绑定到我在Google Container优化的VM中的容器

来自分类Dev

Google App Engine与 Google Apps脚本(在Business Apps中)

来自分类Dev

遍历Google Apps脚本中的对象

来自分类Dev

在Google Apps脚本中设置超时

来自分类Dev

在Google Apps脚本中循环数组

来自分类Dev

在Google Apps脚本中创建枚举ButtonSet

来自分类Dev

避免Google Apps脚本中的formatDate错误

来自分类Dev

侧边栏中的Google Apps脚本授权

来自分类Dev

Google Apps脚本中的Angular JS

来自分类Dev

Google Apps脚本中PropertiesServices的异常行为

来自分类Dev

在Google Apps脚本中记录范围

来自分类Dev

如何限制Google Apps脚本中的行数?

来自分类Dev

在Google Apps脚本中创建条纹令牌

来自分类Dev

在Google Apps脚本中返回数组

来自分类Dev

Apps脚本中的Google Docs API

来自分类Dev

Google Apps脚本中的附件问题

来自分类Dev

Chrome扩展程序中的Google Apps脚本?

来自分类Dev

在Google Apps脚本中删除命名范围

来自分类Dev

Google Apps脚本ContactsApp中的高级搜索

来自分类Dev

在Google Apps脚本中返回空值

来自分类Dev

Google Apps脚本中的标准Javascript

Related 相关文章

热门标签

归档