This is a migrated thread and some comments may be shown as answers.

How to get remote data from jsp to grid?

2 Answers 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ilusisse
Top achievements
Rank 1
ilusisse asked on 11 Sep 2012, 08:02 AM
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!


2 Answers, 1 is accepted

Sort by
0
ilusisse
Top achievements
Rank 1
answered on 11 Sep 2012, 10:34 AM
I found the problems.....thanks!
0
vipin
Top achievements
Rank 1
answered on 29 Sep 2012, 05:56 AM
hello ilusisse,

I m  using the same example and getting problems so can anyone or u  explain what was ur problem and how u solve it.

Thanks

Tags
General Discussions
Asked by
ilusisse
Top achievements
Rank 1
Answers by
ilusisse
Top achievements
Rank 1
vipin
Top achievements
Rank 1
Share this question
or