通过id jaydata获取实体
我用jaydata在WebSQL数据库中创建了任务表通过id jaydata获取实体,jaydata,Jaydata,我用jaydata在WebSQL数据库中创建了任务表 $data.Entity.extend("Task", { Id: { type: "int", key: true, computed: true }, Task: { type: "text", required: true }, La
$data.Entity.extend("Task", {
Id: {
type: "int",
key: true,
computed: true
},
Task: {
type: "text",
required: true
},
Last: {
type: "date"
},
.....
$data.EntityContext.extend("TaskDatabase", {
Tasks: {
type: $data.EntitySet,
elementType: Task
}
});
taskDB = new TaskDatabase("Work");
为什么我的桌子上有两个冒号“Id”
我想通过Id从表中获取实体。我怎么做?谢谢你的回答
我试过(companyId=2):
及
免责声明:我为JayData项目工作 其本质是:
taskDB.onReady(function() {
taskDB.Tasks.find(newTask.TaskId)
.then(function(item) {
document.write("Found:" + JSON.stringify(item) +"<br>");
...
taskDB.onReady(函数(){
taskDB.Tasks.find(newTask.TaskId)
.然后(功能(项目){
document.write(“发现:”+JSON.stringify(item)+“
”;
...
请参考我创建的关于如何创建新项目或查询它们的日志:
至于重复id:它只是一个显示工具-chrome资源查看器将主键列显示为一种行标题。
var task=taskDB.Tasks.attachOrGet({id:companyId});
是有效的,但当我将此代码放到taskDB.onReady()时,id不起作用:(
taskDB.Tasks.single(function (task)
{ return task.Id == this.Id },
{ Id: companyId },
renderCompany);
taskDB.onReady(function() {
taskDB.Tasks.find(newTask.TaskId)
.then(function(item) {
document.write("Found:" + JSON.stringify(item) +"<br>");
...