Hi.
I was struggling those days with a listview.
Basically, I want to load data remotely.
Here-s the html code:
<div data-role="view" data-init="initListView">
<ul id="listView"></ul>
</div>
<script type="text/x-kendo-template" id="foo-template">
#: data #
</script>
And here's the javascript code:
function initListView(e) {
var dataSourcevar = new kendo.data.DataSource({
transport: {
read: {
// the remote service url
url: "http://localhost/PCW/list.php",
// JSONP is required for cross-domain AJAX
dataType: "jsonp"
}
}
});
dataSourcevar.fetch(function() {
var products = dataSourcevar.data();
console.log(products[0].ProductName);
});
e.view.element.find("#listView").kendoMobileListView({
template : $("#foo-template"),
dataSource: dataSourcevar
});
}
I'm loading data from a localhost script made in php. The script displays:
callback([{"id":"1","name":"Chihuahua","picture":"Chihuahua.jpg"},{"id":"2","name":"chow-chow","picture":"chow-chow.jpg"}])
However, neither the data it's displayed, neither the javascript log displays something.
Please help
I was struggling those days with a listview.
Basically, I want to load data remotely.
Here-s the html code:
<div data-role="view" data-init="initListView">
<ul id="listView"></ul>
</div>
<script type="text/x-kendo-template" id="foo-template">
#: data #
</script>
And here's the javascript code:
function initListView(e) {
var dataSourcevar = new kendo.data.DataSource({
transport: {
read: {
// the remote service url
url: "http://localhost/PCW/list.php",
// JSONP is required for cross-domain AJAX
dataType: "jsonp"
}
}
});
dataSourcevar.fetch(function() {
var products = dataSourcevar.data();
console.log(products[0].ProductName);
});
e.view.element.find("#listView").kendoMobileListView({
template : $("#foo-template"),
dataSource: dataSourcevar
});
}
I'm loading data from a localhost script made in php. The script displays:
callback([{"id":"1","name":"Chihuahua","picture":"Chihuahua.jpg"},{"id":"2","name":"chow-chow","picture":"chow-chow.jpg"}])
However, neither the data it's displayed, neither the javascript log displays something.
Please help