How to prevent odata type datasource from encoding the '$'

4 posts, 1 answers
  1. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 16 Jun 2015 Link to this post

    I am using a grid with an odata datasource.

     When I enable serverSorting and serverFiltering it isn't working. For some reason the endpoint (Azure Mobile Service .net Backend) returns a bad request when the $'s are encoded.

    For example, here is a request with the $ encoded:

    GET /tables/members?%24inlinecount=allpages&%24top=50&%24orderby=memberNumber

    For some reason, that returns bad requst: message=The query specified in the URI is not valid. Could not find a property named 'memberNumber' on type 'myapi.DataObjects.Members'.

    But, if I take the same request from fillder into the composer and change it to:

    GET /tables/members?%24inlinecount=allpages&%24top=50&$orderby=memberNumber 

    I get a 200 response and the grid binds to the data no problem.

    I tried to set processData to false, but that just sends like [object:object] on the Url.

    Any idea how I can prevent the $'s from being encoded? Or, how I can turn them back to $, perhaps in the beforeRequest method?




  2. Answer
    Kiril Nikolov
    Kiril Nikolov avatar
    2598 posts

    Posted 18 Jun 2015 Link to this post


    By default the request is encoded, before it is send to the server, and this is fine, and you can see the same in our online demos as well:

    So I suppose it is some server configuration that is causing the issue, can you please take a look in that direction? It will also be helpful if you send us the Grid dataSource configuration. 

    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 18 Jun 2015 in reply to Kiril Nikolov Link to this post

    The backed is a .Net backend Azure Mobile Service. So, the mobile service packages pretty much control the odata implementaiton. I assume it is the same one that you get with Web API. 

    I am using the anguar grid directive, I assume that doesn't change anything. The datasource is part of the gridOptions object I create in the controller:


    dataSource: {
        type: 'odata',
        transport: {
            read: {
                url: constants.apiUrl + '/members',
                dataType: 'json',
                beforeSend: function (req) {
                    req.setRequestHeader('X-ZUMO-AUTH', sessionStorage['X_ZUMO_AUTH']);
        schema: {
            data: function (data) {
                return data.results;
            total: function (data) {
                return data.count;
            model: {
                fields: {
                    memberNumber: { type: "string" },
                    lastName: { type: "string" },
                    firstName: { type: "string" },
                    dateOfExpiry: { type: "date" }



  4. Bob
    Bob avatar
    138 posts
    Member since:
    Sep 2012

    Posted 18 Jun 2015 in reply to Bob Link to this post

    OK... it looks like a serializer case issue. 

    If the $ on filter is encoded it works when I use MemberNumber as the property name in the odata request.

    However, without it encoded it works with both memberNumber and MemberNumber.

    So, there must be something in the odata parser that is different if the $ is encoded vs not encoded.

    I guess off the microsoft I go to figure out how to fix this.




Back to Top