Javascript 未在gridx网格中填充存储数据

Javascript 未在gridx网格中填充存储数据,javascript,html,jsp,servlets,Javascript,Html,Jsp,Servlets,我已经尝试了很多天,也在寻找它,但我没能成功。 请您建议使用服务器端数据填充gridx网格的正确方法 <script type='text/javascript' src='/Firefox/lib/dojo/dojo.js' data-dojo-config="async: true, parseOnLoad: true"></script> <link rel="stylesheet" type="text/css" href="/Firefox/lib/

我已经尝试了很多天,也在寻找它,但我没能成功。 请您建议使用服务器端数据填充gridx网格的正确方法

  <script type='text/javascript' src='/Firefox/lib/dojo/dojo.js' data-dojo-config="async: true, parseOnLoad: true"></script>
 <link rel="stylesheet" type="text/css" href="/Firefox/lib/dijit/themes/claro/claro.css"> 
      <link rel="stylesheet" type="text/css" href="/Firefox/lib/gridx/resources/claro/Gridx.css">

      <link rel="stylesheet" type="text/css" href="/Firefox/lib/dijit/themes/claro/document.css"> 

<script type='text/javascript'>

var grid;


require({
    packages: [
        {
            name: 'gridx',
           location: '/Firefox/lib/gridx'
        }
    ]
},[
             //Require resources.
             "dojo/dom",
             "dojo/store/Memory",
             "dijit/form/Button",
             "gridx/core/model/cache/Sync",
             "gridx/Grid",
                "gridx/modules/CellWidget",
                  "gridx/modules/SingleSort",
                 "gridx/modules/Pagination",
                 "gridx/modules/pagination/PaginationBar",
              //"gridx/tests/support/stores/QueryReadStore",
                 "dojox/data/QueryReadStore",
             "dojo/domReady!"
         ], function(dom, QueryReadStore, Button,Cache, Grid){

        var store = new dojox.data.QueryReadStore({
            /*   data: [
                { id: 1, feedname: 'Feed4', startstop: 'abc', pause: '', config: ''},
                { id: 2, feedname: 'Feed5', startstop: 'sdf', pause: '', config: ''},
                { id: 3, feedname: 'Feed2', startstop: 'fgh', pause: '', config: ''},
            ]  */ 
                 url:'http://localhost:8080/Firefox/firefox',
                 requestMethod : "get"    

     }); 



        var cacheClass = "gridx/core/model/cache/Sync";

        var structure = [
                         { id: 'feedname', field: 'feedname', name: 'Feed Name', width: '110px'},

                         { id: 'startstop', field: 'startstop', name: 'Start/Stop', width: '61px',}



            ];

             //Create grid widget.
                grid =new  gridx.Grid({
                 id: 'grid',
                 //cacheClass: Cache,
                 store: store,
                 structure: structure,  
                  modules: [
                        "gridx/modules/SingleSort",
                         "gridx/modules/Pagination",
                         "gridx/modules/pagination/PaginationBar"
                           ],
                          paginationInitialPageSize: 5,
                          paginationBarSizes: [1, 2, 3],
                            //paginationBarVisibleSteppers: 2,
                            paginationBarGotoButton: false,
                            paginationBarDescription: true, 

                 autoHeight: true,
                 //columnWidthAutoResize: false

             });

             //Put it into the DOM tree.
             grid.placeAt('compactWidgetGrid');

             //Start it up.
             grid.startup();
             //grid.column("feedname").sort(true);
           //  grid.model.sort([{ colId: 'feedname', descending: true }]);
                    grid.body.refresh();
                 // TODO: I need to make Memory and store global somehow so I can get the data before creating the grid!!
               //  updateGridXData(Memory, store);
         });


function updateGridXData(Memory, store) {

            grid.model.clearCache();

            var appFeedsStore;

            // Create new data store for GridX

            //This line was giving a JavaScript error because appFeedListJSON undefined.
            //Commnent out and uncomment other line to see difference.
           // appFeedsStore = createDataStore(Memory, store, appFeedListJSON);
           // appFeedsStore = createDataStore(Memory, store);

           // grid.setStore(appFeedsStore);

           // grid.model.store.setData(appFeedsStore);

        //    grid.refresh();

            grid.body.refresh();

        //},
        //error: function (error) {
        //    console.log("Inside ERROR");
       // }
    //});    
}


</script>


</head>
<body>
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    PrintWriter out= response.getWriter();
    response.setContentType( "application/json");
    out.println("{\"data\":[{\"id\": \"1\", \"feedname\": \"Feed4\", \"startstop\": \"abc\"}]}");
out.flush();
    out.close();
}