Hi,
I am retrieving data from database into JSON object using $.ajax method. I want to bind that data to listview. I am using following example. but in following example json has read from the file but I don't .json file I've an object which I need to bind. Can anyone tell me how to bind json object.
<script type="text/javascript">
var clientData = null;
// Urls to access the WCF Rest service methods
var GetClientUrl = "http://localhost:1000/Service/GetClients/agentId=AG9898";
function initListView() {
$.ajax({
cache: false,
type: "GET",
async: false,
dataType: "json",
url: GetClientUrl,
success: function (clients) {
if (clients != null && clients != "undefined") {
clientData = clients.Clients;
}
},
error: function (xhr) {
clientData = null;
alert(xhr.responseText);
}
});
var ds = new kendo.data.DataSource({
transport: {
read: {
url: "team.json", //Here instead reading a data from file it should read from json object i.e. clientData
dataType: "json"
}
},
change: function () {
//debugger;
}
});
$("#fixed-listview").kendoMobileListView({
dataSource: ds,
template: "#:SortName#"
});
}
</script>
I am retrieving data from database into JSON object using $.ajax method. I want to bind that data to listview. I am using following example. but in following example json has read from the file but I don't .json file I've an object which I need to bind. Can anyone tell me how to bind json object.
<script type="text/javascript">
var clientData = null;
// Urls to access the WCF Rest service methods
var GetClientUrl = "http://localhost:1000/Service/GetClients/agentId=AG9898";
function initListView() {
$.ajax({
cache: false,
type: "GET",
async: false,
dataType: "json",
url: GetClientUrl,
success: function (clients) {
if (clients != null && clients != "undefined") {
clientData = clients.Clients;
}
},
error: function (xhr) {
clientData = null;
alert(xhr.responseText);
}
});
var ds = new kendo.data.DataSource({
transport: {
read: {
url: "team.json", //Here instead reading a data from file it should read from json object i.e. clientData
dataType: "json"
}
},
change: function () {
//debugger;
}
});
$("#fixed-listview").kendoMobileListView({
dataSource: ds,
template: "#:SortName#"
});
}
</script>