How to get remote data from jsp to grid?

3 posts, 0 answers
  1. ilusisse
    ilusisse avatar
    2 posts
    Member since:
    Sep 2012

    Posted 11 Sep 2012 Link to this post

    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. ilusisse
    ilusisse avatar
    2 posts
    Member since:
    Sep 2012

    Posted 11 Sep 2012 Link to this post

    I found the problems.....thanks!
  3. vipin
    vipin avatar
    3 posts
    Member since:
    Aug 2012

    Posted 29 Sep 2012 Link to this post

    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

Back to Top