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.
}
1 回答
在保存之前,您在客户端上没有记录密钥,因为记录密钥是由服务器生成的 . 这适用于自动和手动保存模式 .
这是代码snippet from App Maker documentation: