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

7 posts, 0 answers
  1. Patrick
    Patrick avatar
    29 posts
    Member since:
    Apr 2014

    Posted 23 Apr Link to this post

    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.

  2. Patrick
    Patrick avatar
    29 posts
    Member since:
    Apr 2014

    Posted 23 Apr Link to this post

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

  3. Kendo UI is VS 2017 Ready
  4. Patrick
    Patrick avatar
    29 posts
    Member since:
    Apr 2014

    Posted 23 Apr in reply to Patrick Link to this post

    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) 

     

  5. Patrick
    Patrick avatar
    29 posts
    Member since:
    Apr 2014

    Posted 23 Apr in reply to Patrick Link to this post

     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.
  6. Patrick
    Patrick avatar
    29 posts
    Member since:
    Apr 2014

    Posted 23 Apr in reply to Patrick Link to this post

    Unfortunately the e.sender.transport.options.read.url does not appear to give me the filter in odata syntax.
  7. Patrick
    Patrick avatar
    29 posts
    Member since:
    Apr 2014

    Posted 25 Apr in reply to Patrick Link to this post

    I was given this correct answer on stackoverlow:

     

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

  8. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 27 Apr Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready