JSONP remote data with call function

2 posts, 0 answers
  1. Karel
    Karel avatar
    11 posts
    Member since:
    Aug 2011

    Posted 23 Sep 2012 Link to this post


    I have a problem with data source for autocomplete. I get data from remote service via callback function which fills global json object. I need to use this object as a datasource but I don't know how to refresh datasource because I don't have transport.read method. Is there a way how to refresh datasource somehow?

    This code could help to clafiry:

    YAHOO = { Finance: { SymbolSuggest: { ssCallback: function (jsn) { YAHOOsuggest = jsn; return (jsn); } } } };
    function InitializeStockInput() {
            dataSource: new kendo.data.DataSource({
                data: YAHOOsuggest.ResultSet.Result,
                type: "json"
            placeholder: "Select stock...",
            minLength: 1,
            dataTextField: "name",
            dataValueField: "symbol"
    function StockInputChanged(sender) {
        var url='http://d.yimg.com/autoc.finance.yahoo.com/autoc?query='+ sender.value +'&callback=YAHOO.Finance.SymbolSuggest.ssCallback';
    function helper(url) {
        var head = document.getElementsByTagName('head')[0];
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = url;
        script.id = 'helperScript';
        script.onload = cleaner;
    function cleaner() {
  2. Daniel
    Daniel avatar
    2177 posts

    Posted 27 Sep 2012 Link to this post

    Hello Karel,

    If you have already have loaded the data without the DataSource, you can use its data method to set it. e.g.

    var autoComplete = ("#stockInput").data("kendoAutoComplete");
    Also, note that the AutoComplete does not support a value field and if you need to use separate fields for the text and value you should use ComboBox instead. Regards,
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top