For instance, kendo generates the following url for odata
http://gmovpwbwebdev01:8001/odata/PSellerPartnerMPNLocation?%24format=json&%24expand=PSeller%2C+Geography&%24top=20&%24orderby=PSEllerName&%24filter=((Geography%2FSubsidiaryDistrictId+eq+11182+or+Geography%2FSubsidiaryDistrictId+eq+11179)+and+(Geography%2FSubsidiaryId+eq+161+or+Geography%2FSubsidiaryId+eq+49)+and+Geography%2FAreaId+eq+5)&%24count=true
How do I retrieve the url that is build on the client. I need to send the odata filter to the server for different processing and I don't want to build the string myself if kendo is already doing that.
6 Answers, 1 is accepted
I was given this reply on stack overflow.
Kendo does indeed generate the url according to endpoint, filters, sort etc applied to the widget. However you can access the generated url in the requestStart event.
dataSource: { requestStart: function (e) {var url = e.sender.transport.options.read.url }}
Unfortunately, the response did not work for me:
e.sender.transport.options.read.url appears to give me the options configured when setting up the datasource but not provide the filter that was built (i.e. ?%24format=json&%24expand=PSeller%2C+Geography&%24top=20&%24orderby=PSEllerName&‌%24filter=((Geography%2FSubsidiaryDistrictId+eq+11182+or+Geography%2FSubsidiaryDi‌strictId+eq+11179)+and+(Geography%2FSubsidiaryId+eq+161+or+Geography%2FSubsidiary‌Id+eq+49)+and+Geography%2FAreaId+eq+5)&%24count=true)
I was given this correct answer on stackoverlow:
dataSource: { transport: { read: { url: url, dataType: type, // "json" beforeSend: function (e, request) {var requestUrl = request.url }}}}
The beforeSend handler is what we'd recommend as well. All transport.read options will be forwarded to the jQuery.ajax method.
Regards,
T. Tsonev
Telerik