Unable to map the data source

2 posts, 0 answers
  1. Nirav
    Nirav avatar
    2 posts
    Member since:
    Oct 2015

    Posted 30 Mar 2016 Link to this post

    I trying to map a simple JSON data from the web service to the Kendo UI AutoComplete, but I keep on getting Unexpected token : error. Below is the data set from the service, and the Kendo UI piece.

    {
    "d": [{
    "__type": "Subscriber:#Entities",
    "ContactEmail": null,
    "ContactName": null,
    "ContactPhone": null,
    "FolderPath": null,
    "Notes": null,
    "OrganizationName": "Sample Holdings PLC",
    "ProvisionAckReceived": "\/Date(-62135571600000-0700)\/",
    "ProvisionFileSent": "\/Date(-62135571600000-0700)\/",
    "Status": null,
    "SubscriberUpdated": "\/Date(-62135571600000-0700)\/"
    }, {
    "__type": "Subscriber:#Entities",
    "ContactEmail": null,
    "ContactName": null,
    "ContactPhone": null,
    "FolderPath": null,
    "Notes": null,
    "OrganizationName": "Sample LLC",
    "ProvisionAckReceived": "\/Date(-62135571600000-0700)\/",
    "ProvisionFileSent": "\/Date(-62135571600000-0700)\/",
    "Status": null,
    "SubscriberUpdated": "\/Date(-62135571600000-0700)\/"
    }, {
    "__type": "Subscriber:#Entities",
    "ContactEmail": null,
    "ContactName": null,
    "ContactPhone": null,
    "FolderPath": null,
    "Notes": null,
    "OrganizationName": "Test LLC",
    "ProvisionAckReceived": "\/Date(-62135571600000-0700)\/",
    "ProvisionFileSent": "\/Date(-62135571600000-0700)\/",
    "Status": null,
    "SubscriberUpdated": "\/Date(-62135571600000-0700)\/"
    }]
    }

    <script>

    $("#search").kendoAutoComplete({            
    dataTextField: "OrganizationName",            
    minLength: 3,
    dataSource: {
    type: "odata",
    transport: {
    read: GetServiceUrl('SubscriberSubscriptionSearch'),
    parameterMap: function () {
    return { searchText: $("#search").data("kendoAutoComplete").value() };
    }
    },
    schema: {                    
    data: "d",
    model: {
    fields: {
    OrganizationName: { type: "string" }
    }
    }
    }
    },           
    placeholder: " Search existing Subscribers/Subscriptions",
    close: onClose
    });

    </script>

     

     

  2. Nirav
    Nirav avatar
    2 posts
    Member since:
    Oct 2015

    Posted 30 Mar 2016 in reply to Nirav Link to this post

    Never mind. Changing the datatype from odata to json fixed the problem.
Back to Top