I'm using a kendo grid and I want to alter the JavaScript structure before doing the http call.My datasource type is odata.
The problem is as soon as I add the parameterMap the odata $filter, $skip, $top is no longer sent and formatted to odata.
I want to override this for the update operation only.
The example does that but there is no filter implemented (http://demos.kendoui.com/web/grid/editing.html) and therefore it is an incomplete example
.
parameterMap: function(options) {
alert(options.filter.filters[0])
}
I have access to the filters but how can I put back the standard behavior along with my custom needs.
I know there is a toOdataFilter function being used to convert these but struggling how to keep the standard odata support and adding my custom needs.
Anyone has already faced this issue and figure out how to handle this?
Thanks.
11 Answers, 1 is accepted
Currently, you may use the following code to call the default implementation of oData parameter map:
dataSource: {
type:
"odata"
,
transport: {
read:
"URL"
,
parameterMap:
function
(options, type) {
options.foo =
"bar"
;
// do something here
return
kendo.data.transports[
"odata"
].parameterMap(options, type);
}
},
//...
}
Greetings,
Rosen
the Telerik team
transport: {
parameterMap: function(data,operation) {
if (operation == 'read') {
return kendo.data.transports["odata"].parameterMap(data,operation)
}
else {
return {
$operation: function () { return operation},
$callback: function () { return ""},
Could you please provide a bit more information about what you are trying to achieve?
All the best,Rosen
the Telerik team
My updates to the server are good. The only problem I have is returning the call back string to the client-side.
When I commit my changes, how can I obtain the callback strin. Since I have override the paramaterMap, the callback string is not sent.
In order to send back in the update response the callback I need to send it to the server along with the models data.
This is to allow me to return:
jQuery171033428954028692415_1330953452468( |
Thank you.
Example if the http post parameters:
callback | jQuery171033428954028692415_1330953452468 |
models | [{"ProductID":1,"ProductName":"Chai111","UnitPrice":18,"UnitsInStock":39,"Discontinued":false}] |
You do not need to get the generated by jQuery callback name and manually send it to the server, with the latest (Q3 SP1 2011+) official version of KendoUI it should be automatically send as $callback. Note that you should make sure you do not set is explicitly.
Rosen
the Telerik team
I noticed something, the parameter for the read is $callback and for the update/destroy is callback.
Now I returned the proper callback but the grid doesn't update automatically (the red marker remains).
Do I need to do something manually to refresh the grid?
You should verify that the request send to the server during the update/create/delete operations is successive and the success function pass from the DataSource is executed.
All the best,Rosen
the Telerik team
Maybe I need to send a specific code to force the Kendo grid to be refreshed?
....
success: function () {
alert('Record(s) updated successfully.')
},
error: function(e)
{
// Code is the additional field to show in the error message. Title to show is taken from Kendo grid columns object.
alert('Update has failed!'+dtGetErrMsgFromResponseText(e.responseText,'Code', $("#grid").data("kendoGrid").columns));
},
....
Could you please provide a small sample which demonstrates the scenario you are trying to achieve and your implementation. This will allow us to get better understanding about your case and provide you with more to-the-point answer.
Greetings,Rosen
the Telerik team
I was facing the same issue and this thread solved the problem.
I'd like to tell that you and your team are doing an excellent job. Congrats for the high quality Product.
Alessandro.