Google App厂商记录键值 [英] Google App maker record key value

查看:54
本文介绍了Google App厂商记录键值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在App maker中,我们启用了手动保存模式.单击按钮后,将打开一个新表单,我们将创建一个空记录,当用户填写字段并单击保存"按钮时,saveChanges函数将保存所有值.

In App maker we enabled the manual save mode. On button click a new form will open and we will create an empty record, when user fills the fields and clicks the save button saveChanges function will save all the values.

在文档和示例项目中,我可以看到在数据源中更新了记录创建_key值之后,我们可以使用该键值从其子模型中查询记录.

In documentation and sample projects I can see after a record creation _key value is updated in the data source and we can use that key value to query record from its child model.

但是在我们的情况下,不返回键值.但是,当我们打开记录键值时,保存更改功能启动后,可能是问题所在.

But in our case key value is not returned. But after save changes function when we open that record key value is coming, what could be the issue.

推荐答案

由于记录密钥是由服务器生成的,因此在您保存之前,客户端上没有记录密钥.这适用于自动和手动保存模式.

You don't have record key on the client, until you save it, since record key is generated by the server. This applies both to Auto and Manual save modes.

这里是代码 App Maker文档中的代码段:

Here is code snippet from App Maker documentation:

 var myCreateDatasource = app.datasources.MyDatasource.modes.create;
 var draft = myCreateDatasource.item;
 draft.Name = "Name";
 draft.Age = 21;

 // Create the new item
 myCreateDatasource.createItem(function(newRecord) {
   // Callback is called after the record is saved, so it now has a key.
   var key = newRecord._key;
   // Do something with the key here.
 }

这篇关于Google App厂商记录键值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆