google-app-maker - 网格单元在开始搜索之前正在收集数据
问题描述
我正在尝试使用用户选择器来收集输入的多个数据,然后将数据存储到网格单元中以显示。但是现在,我的网格单元格甚至在我开始搜索之前就显示为空单元格。并且数据为空。员工姓名“OnValueChange”代码为“addTrainee(widget, newValue);”
var ds = app.pages.PracticePage.descendants.Grid1.datasource;
var traineesEmails = ds.items.map(function(item) {
return item.PrimaryEmail;
});
return traineesEmails.indexOf(primaryEmail);
}
function deleteTrainee(primaryEmail) {
var testBox = app.pages.PracticePage.descendants.TestBox;
//Test
console.log ("Email: "+primaryEmail);
console.log("Before: "+ testBox.value);
testBox.value = testBox.value.replace(primaryEmail,"");
console.log("After: "+ testBox.value);
//Test
var index = getTraineeIndex(primaryEmail);
if (index === -1) {
return;
}
var ds = app.pages.PracticePage.descendants.Grid1.datasource;
ds.items.splice(index, 1);
}
function addTrainee(userPickerWidget, newValue) {
if (!newValue) {
console.log("Checking for new Value Statement.");
return;
}
if (getTraineeIndex(newValue.PrimaryEmail) > -1) {
console.log("Cheking for repeatation");
return;
}
var ds = app.pages.PracticePage.descendants.Grid1.datasource;
ds.items.push({
FullName: newValue.FullName,
PrimaryEmail: newValue.PrimaryEmail,
});
console.log("Pushed Email Address: ", newValue.PrimaryEmail);
var testBox = app.pages.PracticePage.descendants.TestBox;
if(testBox.value === null){
testBox.value = newValue.PrimaryEmail;
console.log("No data in text box");
}
else {
testBox.value = testBox.value + ", "+ newValue.PrimaryEmail;
console.log("Enter data in text box");
}
userPickerWidget.value = null;
}
function addNewData(PrimaryEmail){
console.log("running AddNewData function ");
while(typeof(PrimaryEmail) != undefined){
console.log("returning Primary Email: "+ PrimaryEmail);
return PrimaryEmail;
}
}
并且网格单元没有任何事件。网格单元格内标签的文本值。应该收集电子邮件地址的是“addNewData(@datasource.item['PrimaryEmail'])”
背后的原因是什么?以及如何解决?
解决方案
推荐阅读
- gitlab - gitlab runner 是否可以在部署期间签出没有 .git 文件夹的 repo?
- javascript - 如何使particle.js中的每个粒子可点击?
- java - 如何使服务线程安全(宁静)
- sqlite - 如何在 android studio 中删除 sqlite 中的特定表?
- akka.net - 向 Akka.Net ConsistentHashingPool routees 广播消息的最佳方式是什么?
- sql-server - INNER select 语句中的数据类型定义为 MONEY,但随后在外部 SELECT 语句中更改为 int 数据类型
- css - 如何调整内部元素的宽度以使其自然换行?
- apache-spark - 通过 Spark 在 S3 前缀分区中回滚写入失败
- javascript - 如何用两个元素替换一个 DOM 元素 - vanilla js
- graph - 有没有办法使用图表来描述 Power Bi 表中记录子集的状态?