Here are some preliminary docs on the internal API used to fetch data when running offline (these can still change, so use at your own risk):
Description
Retrieve MxObjects when running offline.
mx.data.getSlice(
entity: string,
constraints: Object[],
filter: Object,
callback: (objs: MxObject[], count: number) => void,
error: (e: Error) => void
)
Parameters
equals
, lessThan
, lessThanOrEquals
, greatherThan
, greaterThanOrEquals
, contains
.true
, return the objects not matching the constraintExamples:
mx.data.getSlice("MyFirstModule.Pet", null, null, function(mxobjs, count) {
console.log("There are " + count + " pets");
});
mx.data.getSlice("MyFirstModule.Pet", {
attribute: "MyFirstModule.Pet_Person",
operator: "equals",
value: "1234" // the guid of the owner, which is a Person entity
}, null, function(mxobjs, count) {
console.log("There are " + count + "pets referring to owner 1234");
});
mx.data.getSlice("MyFirstModule.Pet", [{
attribute: "Name",
operator: "contains",
value: "ed"
}, {
attribute: "Age",
operator: "greaterThan",
value: 2
}], {
offset: 15,
limit: 5,
sort: [["Name", "asc"], ["Age", "desc"]]
}, function(mxobjs, count) {
console.log("Pets that matched your filter: " + mxobjs.length);
console.log("Pets that matched your query: " + count);
}, function(e) {
console.error("An error occured: " + e.message);
});
Good question! In offline mode, you don't have access to requests using xpath, as the local sqlite database doesn't support that type of querying. At the moment, offline is still in beta so we don't have any documented APIs for querying sets of data (the normal get by id APIs should work fine)
I'll see if I can find someone to post an example of an internal API that you could use temporarily until we finalize everything in Mendix 7.