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

Unable to map the data source

1 Answer 44 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Nirav
Top achievements
Rank 1
Nirav asked on 30 Mar 2016, 08:23 PM

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>

 

 

1 Answer, 1 is accepted

Sort by
0
Nirav
Top achievements
Rank 1
answered on 30 Mar 2016, 09:31 PM
Never mind. Changing the datatype from odata to json fixed the problem.
Tags
AutoComplete
Asked by
Nirav
Top achievements
Rank 1
Answers by
Nirav
Top achievements
Rank 1
Share this question
or