{ where: {id: {gt: 1}}, skip: 1, fields: ['id','lastName]};
{ where: {lastName:'Brown'} }
Then I will serialize this for the url using
$.param( myObject )I know I can transform the object produced by the datagrid in the beforSend method.
The xml docs refer to converting data received from the server. The header docs has nothing to do with data format sent to the servers but just adding headers
What I what I was looking for was an example of how you would Send data to the server in a specific format. My server expects a Where clause data Sent to the server to look like this { where: {id: {gt: 1}}, skip: 1, fields: ['id','lastName]}; I don't understand how your example produces a different json format Sent to the server.
Further clarification
So in the grid on the id column. In the filter menu if I choose Greater Than 1 then the I expect { where: { where: {id: {gt: 1}}, skip: 0, fields: ['id']}; to be sent to the server.
Thank you.
I don't understand this example at all. I don't see a custom adapter in the code, I am used to the javascript version as I know nothing about .net. How can we produced the json in the format I need without a custom adapter?
Alan I think you miss understood I need to send data to the server in a specific format json format as outlined.
I am sorry to take up so much of your time and I really do appreciate your help
{title:
{nlike:
'M.-XY'}}
loopback.io
IBM and the StrongLoop team are committed to maintaining and improving the LoopBack open-source project! Building on LoopBack's success as an open-source Node.js ... |
<script type="text/javascript">
$(function () {
var customAdaptor = new ej.Adaptor().extend({
processQuery: function (ds, query) {
var result = ds.dataSource.json.slice(0), count = result.length, cntFlg = true, ret, key, agg = {};
for (var i = 0; i < query.queries.length; i++) {
key = query.queries[i];
ret = this[key.fn].call(this, result, key.e, query);
if (key.fn == "onAggregates")
agg[key.e.field + " - " + key.e.type] = ret;
else
result = ret !== undefined ? ret : result;
if (key.fn === "onPage" || key.fn === "onSkip" || key.fn === "onTake" || key.fn === "onRange") cntFlg = false;
if (cntFlg) count = result.length;
}
//handle where query here
if (query._requiresCount) {
result = {
result: result,
count: count,
aggregates: agg
};
}
return result;
},
processResponse: function (data, ds, query, xhr) {
if (data.d)
return data.d;
return data;
}
});
var dataManager = new ej.DataManager(window.gridData);
// assigning custom adaptor to datamanager
dataManager.adaptor = new customAdaptor();
$("#Grid").ejGrid({
dataSource: dataManager,
allowFiltering: true,
columns: ["OrderID", "CustomerID", "EmployeeID"]
});
});
</script> |