I want to get remote data from jsp with json type.
I have modified the example file : virtualization-remote-data.html as follows :
<script>
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
serverPaging: true,
serverSorting: true,
pageSize: 100,
transport: {
read: "http://localhost:8060/data.jsp",
type: "jsonp"
},
schema: {
data: "results"
}
},
height: 280,
scrollable: {
virtual: true
},
sortable: true,
columns: [
"OrderID",
"CustomerID",
{ field:"ShipName", title:"Ship Name" },
{ field: "ShipCity", title:"Ship City" }
]
});
});
</script>
And my data.jsp as follows:
<%@ page contentType="application/json" %>
<%@ page pageEncoding="UTF-8" %>
<%
try {
//String json = "[{\"results\":[{\"OrderID\":\"100\",\"CustomerID\":\"122\",\"ShipName\":\"B\",\"ShipCity\":\"D\"}]}]";
String json = "{\"results\":[{\"OrderID\":\"100\",\"CustomerID\":\"122\",\"ShipName\":\"B\",\"ShipCity\":\"D\"}]}";
response.getWriter().write(json);
} catch(Exception ex) {
}
%>
But the grid have not show any data after loading.
Is there any missing or mistakes in my code?
Thanks!
I have modified the example file : virtualization-remote-data.html as follows :
<script>
$(document).ready(function() {
$("#grid").kendoGrid({
dataSource: {
serverPaging: true,
serverSorting: true,
pageSize: 100,
transport: {
read: "http://localhost:8060/data.jsp",
type: "jsonp"
},
schema: {
data: "results"
}
},
height: 280,
scrollable: {
virtual: true
},
sortable: true,
columns: [
"OrderID",
"CustomerID",
{ field:"ShipName", title:"Ship Name" },
{ field: "ShipCity", title:"Ship City" }
]
});
});
</script>
And my data.jsp as follows:
<%@ page contentType="application/json" %>
<%@ page pageEncoding="UTF-8" %>
<%
try {
//String json = "[{\"results\":[{\"OrderID\":\"100\",\"CustomerID\":\"122\",\"ShipName\":\"B\",\"ShipCity\":\"D\"}]}]";
String json = "{\"results\":[{\"OrderID\":\"100\",\"CustomerID\":\"122\",\"ShipName\":\"B\",\"ShipCity\":\"D\"}]}";
response.getWriter().write(json);
} catch(Exception ex) {
}
%>
But the grid have not show any data after loading.
Is there any missing or mistakes in my code?
Thanks!