Hi,
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:
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:
YAHOOsuggest={ResultSet:{Query:
''
,Result:[]}};<br>
YAHOO = { Finance: { SymbolSuggest: { ssCallback:
function
(jsn) { YAHOOsuggest = jsn;
return
(jsn); } } } };
function
InitializeStockInput() {
$(
"#stockInput"
).kendoAutoComplete({<br>
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'
;
helper(url);
}
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;
head.appendChild(script);
}
function
cleaner() {
$(
'#helperScript'
).remove();
}