我寫了這個代碼在Chrome中使用的WebSQL與JayData:實體在JayData方面是未定義
$data.Entity.extend("$org.types.Department",
{
Id: { type: "int", key: true, computed: true },
Name: { type: "string", required: true }
});
$data.EntityContext.extend("$org.types.OrgContext", {
Department: { type: $data.EntitySet, elementType: $org.types.Department }
});
$org.context = new $org.types.OrgContext({ name: "WebSQL", databaseName:"Organization",
dbCreation: $data.storageProviders.sqLite.DbCreationType.DropTableIfChanged
});
var department = new $org.types.Department({ Name: 'Department1' });
$org.context.Department.add(department);
$org.context.saveChanges();
但問題是,在$ org.context.Department.add(部門);行,「部門」是undefined.What我該怎麼辦?
$ data.ODataProvider支持直接調用,而不需要onReady處理程序,但它總是最安全的使用它,因爲它不會傷害:)。 –