I write only super high performance RESTful services that support both If-Modified-Since and If-None-Match request headers for data services. Your randomization of the JSONP callback function name is killing my performance because it's making each subsequent request to the service random rather than static. I don't see a way via configuration to make the JSONP call static and/or programmable. Any suggestions?
6 Answers, 1 is accepted
0
Hello,
Atanas Korchev
the Telerik team
The Kendo UI DataSource relies entirely on $.ajax for making remote service requests. The jsonpCallbackString setting can be used to set your own callback name. Here is how to do this via the transport:
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "....",
jsonpCallbackString: "mycallback"
}
}
});
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Jeff
Top achievements
Rank 1
answered on 12 Jun 2012, 10:43 PM
I downloaded version kendoui.complete.2012.1.515.commercial and am not seeing it working. Here's my code:
Service call:
/[Service]/[Endpoint]?$callback=jQuery171022314564533574405_1339541647044&%24inlinecount=allpages&%24format=json&%24top=5
In which version is this fixed? If not in the current build, can I get a hotfix?
This configuration doesn't appear to be documented - http://www.kendoui.com/documentation/framework/datasource/configuration.aspx#transport. Could you be sure to update the documentation? All developers rely on it almost exclusively.
http://www.kendoui.com/documentation/framework/datasource/configuration.aspx#read
Thanks,
Jeff
$("#productsTable").kendoGrid({ dataSource: { type: "odata", transport: { read: { url: "[ServiceUrl]" , jsonpCallbackString: "mycallback" } }, pageSize: 5, serverPaging: true, serverFiltering: true, serverSorting: true }, rowTemplate: kendo.template($("#rowTemplate").html()), filterable: true, sortable: true, pageable: true });
Service call:
/[Service]/[Endpoint]?$callback=jQuery171022314564533574405_1339541647044&%24inlinecount=allpages&%24format=json&%24top=5
In which version is this fixed? If not in the current build, can I get a hotfix?
This configuration doesn't appear to be documented - http://www.kendoui.com/documentation/framework/datasource/configuration.aspx#transport. Could you be sure to update the documentation? All developers rely on it almost exclusively.
http://www.kendoui.com/documentation/framework/datasource/configuration.aspx#read
Thanks,
Jeff
0
Hi Jeff,
Atanas Korchev
the Telerik team
I have mislead you in my previous reply. The right setting is jsonpCallback. Please accept my apologies.
Here is a live demo showing how to use this setting: http://jsfiddle.net/korchev/QKtkx/1/
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Jeff
Top achievements
Rank 1
answered on 13 Jun 2012, 04:55 PM
Thank you Atanas! Using the jsonpCallback worked and my service automatically started working with 304 Not Modified, EXCELLENT! I love <1ms service response time over the internet!
Thanks for the update!
Thanks for the update!
0

Darren
Top achievements
Rank 1
answered on 23 Jul 2012, 01:45 PM
When I try this method, I still see a random value being generated:
This produces the following url:
Is there anyway to not have that random string, so that this call can be cached?
data:
new
kendo.data.HierarchicalDataSource({
type:
'json'
,
transport: {
read: {
url:
'/common/menu'
,
dataType:
'jsonp'
,
contentType:
'application/json'
,
jsonpCallback:
'myCallback'
}
},
schema: {
model: {
children:
'Children'
}
}
})
This produces the following url:
[base] ... /common/menu?callback=myCallback&_=1343050635987
Is there anyway to not have that random string, so that this call can be cached?
0

Stevoh
Top achievements
Rank 1
answered on 28 Feb 2013, 06:36 PM
Hi,
I tried all the above techniques but they did not work, I then saw a post in stack overflow which advised to check the querystring variable 'callback' and set our jsonp function at the server side equivalent to that value, that way they would always be the same.
check this out (describes asp.net web services but is easy to understand and replicate for other languages too) http://stackoverflow.com/questions/2380551/jquery-success-function-not-firing-using-jsonp
I tried all the above techniques but they did not work, I then saw a post in stack overflow which advised to check the querystring variable 'callback' and set our jsonp function at the server side equivalent to that value, that way they would always be the same.
check this out (describes asp.net web services but is easy to understand and replicate for other languages too) http://stackoverflow.com/questions/2380551/jquery-success-function-not-firing-using-jsonp