This is a migrated thread and some comments may be shown as answers.

How do i get the url that kendo builds on the client

6 Answers 556 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 23 Apr 2016, 07:48 AM

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

Sort by
0
Patrick
Top achievements
Rank 1
answered on 23 Apr 2016, 05:50 PM

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 }}

0
Patrick
Top achievements
Rank 1
answered on 23 Apr 2016, 06:21 PM

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) 

 

0
Patrick
Top achievements
Rank 1
answered on 23 Apr 2016, 06:22 PM
 e.sender.transport.options.read.url  unfortanately does not appear to give the filters in url format so that stack overflow response does not work for me.  Help would be appreciated.
0
Patrick
Top achievements
Rank 1
answered on 23 Apr 2016, 06:27 PM
Unfortunately the e.sender.transport.options.read.url does not appear to give me the filter in odata syntax.
0
Patrick
Top achievements
Rank 1
answered on 25 Apr 2016, 11:56 AM

I was given this correct answer on stackoverlow:

 

dataSource: { transport: { read: { url: url, dataType: type, // "json" beforeSend: function (e, request) {var requestUrl = request.url }}}}

0
T. Tsonev
Telerik team
answered on 27 Apr 2016, 06:19 AM
Hello,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or