Hi Dan,
Thanks for contacting Syncfusion Support.
Query 1. What is the format of the json object produced by the datamanager including meta data?
The Datamanager produces JSON object in the following format.
actual:Object | Contains all the records as it is from the data source. |
count:13304 | Contains total count of records. |
query:ej.Query | Contains filtering based on query like page index and page size, no of records to take. |
request:Object | Contains all the necessary data before posting a request. |
result:Array[5] | Contains filtered results on the data based on query. |
xhr:Object | Contains xhr data. |
Query 2. What is the datamanager expecting for a response object?
Example Response:
{
"page_number": 5,
"page_size": 20,
"total_record_count": 521,
"records": [
{
"id": 1,
"name": "Widget #1"
},
{
"id": 2,
"name": "Widget #2"
},
{
"id": 3,
"name": "Widget #3"
}
]
}
To get page number and page size in your response, you need to enable paging property of the datamanager using query. To get Total number of records, you need to enable requiresCount property, Refer to the below code snippet.
var query = ej.Query() .from("Orders") .select("OrderID", "CustomerID", " EmployeeID", "Freight", "ShipCountry") .page(1,5) .requiresCount(); var execute = dataManager.executeQuery(query) // executing query .done(function (e) { // access the response object }); |
Note: Page number and page size can be obtained from ‘query’ in response object.
Regards,
Prince