javascript - Google App Script WebApp Array 不会从后端传递到前端
问题描述
我有一个项目,我将 Google 表格用作数据库,并将 Web 应用程序用作前端。
直到昨天,一个数据数组从后端传递到前端,但它不再起作用了。后端的 logger.log 显示我们有一个数组。但是前端永远不会收到数据。
后端代码(ssAssessmentLogic 是数据表)
function getDropDownArray(){
var arrDevLogic = ssAssessmentLogic.getDataRange().getValues();
var arrDevLogic =arrDevLogic.filter(function (dataRow) {return dataRow[5] == nutzerSquad})
return arrDevLogic;
前端代码:
function afterPageLoads(){ //Loads the Dropdowns. First gets the data from the spreadsheet and then populates the dropdowns with the array
google.script.run.withSuccessHandler(afterDataArrayReturned).getDropDownArray();
}
function afterDataArrayReturned(arrDevLogic){ //after the array withe the data came back from the sheet, store the data in a global html variable and pass it to the function to fill the drodown
console.log(arrDevLogic);
arrayOfValues = arrDevLogic.filter(function(r){return true;});
var item = document.getElementById("sdp_ms");
addUniqueDropdown(item, arrayOfValues, 4);
}
在加载 html 页面时,我收到一个错误,即 null 过滤器不起作用,并将控制台日志值显示为 null。如果我只运行后端函数,它会为我提供一个包含 260 个项目的数组数组。
有人可以帮我找出问题吗?
解决方案
看来我找到了解决方案。在数组数组中,“行数组”中的某些字段是日期,而其他字段为空白。当某些数组具有日期值而某些数组为空白时,代码的 HTML 部分似乎不喜欢它。
谢谢大家的帮助。
推荐阅读
- python - 在 django 中保存多个隐藏字段
- spring-boot - cucumber.plugin 设置正在生成空报告
- vue.js - Vue:登录/注销后标题不会更新,但 localStorage 已更改
- javascript - 令牌 + 电子邮件授权的请求标头
- php - 日历使用限制超出但不超过任何配额
- python - 提高性能 cv2.calibrateCamera
- ansible - 将厨师食谱部分转换为 ansible
- netflix-eureka - 使用 EurekaHttpClient 手动注册服务时获取 http 代码状态 400
- java - Java combining ArrayList contains() and ArrayList remove()
- excel - 在 excel 中删除/清除表格内容但保留最后三列的宏