jaydata Uncaught TypeError: Type error with indexedDb

194 Views Asked by At

This code is from official examples is works fine with webSql, but I get Uncaught TypeError: Type error with indexedDb provider.

What is wrong here? (provider is included in html)

/* define a data model. */
$data.Entity.extend("$org.types.Department", {
    Id: { type: "int", key: true, computed: true },
    Name: { type: "string", required: true },
    Address: { type: "string" },
    Employees: { type: "Array", elementType: "$org.types.Employee", inverseProperty: "Department" }
});

$data.Entity.extend("$org.types.Employee", {
    Id: { type: "int", key: true, computed: true },
    FirstName: { type: "string", required: true },
    LastName: { type: "string", required: true },
    Department: { type: "$org.types.Department", inverseProperty:"Employees"}
});

$data.EntityContext.extend("$org.types.OrgContext", {
    Department: { type: $data.EntitySet, elementType: $org.types.Department },
    Employee: { type: $data.EntitySet, elementType: $org.types.Employee }
});


//Now that the model is defined, instantiate the context (ie. set up the connection or the local database):
$org.context = new $org.types.OrgContext({ name: "indexedDb", databaseName: "OrgDB" });
$org.context.onReady(function() {
    //Create new ones...
    var emp = new $org.types.Employee({ FirstName: 'John', LastName: 'Doe' });
    $org.context.Employee.add(emp);
    $org.context.saveChanges();
});

UPD: Now I see that this error is in the indexedDbProvider.min.js

1

There are 1 best solutions below

1
On

This is working with the latest Chrome. Make sure you load the modules in the correct order (JayData library must be the first, than you can load the providers/modules).