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

JSON results

1 Answer 182 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Gabriel
Top achievements
Rank 1
Gabriel asked on 26 Dec 2011, 11:52 PM
I have an autocomplete connecting to a WCF web serivce that returns data a JSON string.

Here is how I create the autocomplete:
var search = $("#searchBox").kendoAutoComplete({
            minLength: 3,
            separator: ", ",
            dataSource: {
                type: "json",
                transport: {
                    read: "../getTitles",
                    parameterMap: function() {
                        return { sku: $("#searchBox").data("kendoAutoComplete").value() };
                    }
                }
            }
        });

The data returned is a JSON string as follows:
["Test", "Test 2", "Test 3"]

Nothing actually shows inside the autocomplete box... Am I missing something...

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Dec 2011, 08:46 AM
Hello,

Are you sure this is the result returned by the WCF service? They normally return something like this:

{
      d : <actual result>
}

You need to tell the DataSource what the schema of the data is:

dataSource: {
  schema: {
      data: "d"
  },
  /* rest of configuration */
}

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
AutoComplete
Asked by
Gabriel
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or