小编use*_*733的帖子

如何使用GAS中的Properties服务正确存储全局值?

我在使用 Google Apps 脚本时遇到此问题。\n我的电子表格中有一个菜单,其中有两个选项(设置密码和添加时间记录)。这些选项分别引发 UI 服务用户界面以提示其数据。为了访问添加时间记录,我之前会询问用户是否经过身份验证。我使用 scriptProperties = PropertiesService.getScriptProperties() 和 setProperty('authenticated', false) 来保存已验证的初始值。

\n\n

1-我单击“设置密码”,我确实登录并关闭了用户界面。

\n\n

2-我单击添加时间记录,我希望收到我的添加时间记录 Ui(因为我先设置密码),但我收到的是设置密码 UI。即使我再次登录,我也会一次又一次收到相同的 UI \xe2\x80\xa6。

\n\n

就像每次我单击菜单选项时,无论我之前执行了什么操作,身份验证都会重置为 false。这是预期的行为吗?或者我\xe2\x80\x99m做错了什么?非常感谢你的帮助。

\n\n
var scriptProperties = PropertiesService.getScriptProperties();\nscriptProperties.setProperty('authenticated', 'false');\nfunction onOpen() {\n  var ui = SpreadsheetApp.getUi();\n  ui.createMenu('ProWorkflow')\n    .addItem('Set Pasword', 'getPassword').addSeparator()\n    .addItem('Add Time Record', 'isAuthenticated').addSeparator()\n    .addToUi();\n}\nfunction isAuthenticated()\n{\n  var scriptProperties = PropertiesService.getScriptProperties();\n  var value = scriptProperties.getProperty('authenticated');\n  if(value =='false'){\n    getPassword(); // at the end of this function I set scriptProperties.setProperty('authenticated', \xe2\x80\x98true\xe2\x80\x99);\n  }\n  return addTimeRecord();\n}\nfunction getPassword(e)\n{\n    \xe2\x80\xa6\n    \xe2\x80\xa6\n    \xe2\x80\xa6\n   var scriptProperties = PropertiesService.getScriptProperties();\n   var …
Run Code Online (Sandbox Code Playgroud)

global-variables google-apps-script

3
推荐指数
1
解决办法
9953
查看次数

DropDownList没有填充数据源中的数据

嗨,我正在使用telerik appBuilder进行我的第一个应用程序移动,我无法使用下拉列表来使用Kendo数据源.

我的webservices的结果如下,但我无法获得该结果的正确数据绑定.

{"d":[{"id":2209,"nom":"Test 1"},{"id":23608,"nom":"Test 2"},{"id":24061,"nom" :"测试3"},{"id":24741,"nom":"测试4"},{"id":27347,"nom":"测试5"}}}

请问,有什么想法吗?非常感谢.

/* product.html*/
<div id="product" data-role = "view"
         data-layout = "sharedlayout" data-model="app.productService.viewModel">                              
    <div class="view-content">
       <form >
           <div data-role="listview" data-style="inset">
             <div>
                Products:
                    <select id="product" data-role="dropdownlist"
                            data-bind="source: productsdataSource " 
                            data-text-field="id" 
                            data-value-field="product">
                        <option value="0"> </option>  
                    </select>
             </div>
          </div>
       </form>
    </div>
</div>   
Run Code Online (Sandbox Code Playgroud)

ProductViewModel.js

(function (global) 
{
    var ProductsViewModel,
        app = global.app = global.app || {};

    ProductsViewModel = kendo.data.ObservableObject.extend (
    {
        getProducts: function() {
            var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "urlexample",
                        type:"post",
                        contentType: "application/json; …
Run Code Online (Sandbox Code Playgroud)

datasource viewmodel kendo-ui kendo-dropdown telerik-appbuilder

1
推荐指数
1
解决办法
1079
查看次数