spring dojo EnhancedGrid 出不来数据,怎么办啊?

我的jsp如下:

<%@page language="java" isELIgnored="false" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<html >
<head>
<meta name="decorator" content="none"/>
 <link rel="stylesheet" href="${pageContext.request.contextPath}/dojo/dijit/themes/claro/claro.css">
 <style type="text/css">@import "${pageContext.request.contextPath}/dojo/dojo/resources/dojo.css";
@import "${pageContext.request.contextPath}/dojo/dijit/themes/claro/claro.css";
@import "${pageContext.request.contextPath}/dojo/dojox/grid/enhanced/resources/claro/EnhancedGrid.css";
@import "${pageContext.request.contextPath}/dojo/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css";

/*Grid need a explicit width/height by default*/
#grid {
    width: 100%;
    height:100%;
}</style>
<script>dojoConfig = {parseOnLoad: true}</script><script src='${pageContext.request.contextPath}/dojo/dojo/dojo.js'></script><script>dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojox.grid.enhanced.plugins.Pagination");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojo/store/Memory");
dojo.require("dojo.data.ObjectStore");
dojo.ready(function(){
 var dataStore;
     /*set up data store*/
   var data= dojo.xhrGet({
    url:"${pageContext.request.contextPath}/getAllActivity",
    handleAs:"json",
    load: function(data){
     dataStore = new dojo.data.ItemFileReadStore({data: data});
   }
});
 

    /*set up layout*/
    var layout = [[
      { name: "项目名称", field: "projectName", width: "120px" },
                        { name: "活动内容", field: "activityField", width: "120px" },
                        { name: "计划", field: "specification", width: "150px;" },
                        { name: "活动时间", field: "activityTime", width: "150px" },
                        { name: "活动人", field: "user", width: "120px" },
                        { name: "备注", field: "memo", width: "80px" }
    ]];

    /*create a new grid:*/
    var grid = new dojox.grid.EnhancedGrid({
        id: 'grid',
        store: dataStore,
        structure: layout,
        rowSelector: '20px',
        plugins: {
          pagination: {
              pageSizes: ["25", "50", "100", "All"],
              description: true,
              sizeSwitch: true,
              pageStepper: true,
              gotoButton: true,
                      /*page step to be displayed*/
              maxPageStep: 4,
                      /*position of the pagination bar*/
              position: "bottom"
          }
        }
    }, document.createElement('div'));

    /*append the new grid to the div*/
    dojo.byId("gridDiv").appendChild(grid.domNode);

    /*Call startup() to render the grid*/
    grid.startup();
});</script>
</head>
<body class="claro">
    <div id="gridDiv"></div>
</body>
</html>

后台的json代码如下:@RequestMapping("/getAllActivity")
 @ResponseBody
 public Map<String,List>getAllActivity()throws Exception{
  Map<String,List> josnMap = new HashMap<String,List>();
  List<Activity> activities =queryManageService.findAllActivity();
 List list=new ArrayList(); 
 for(Activity activity:activities)
 {
  Map<String,Object> activityMap=new HashMap<String,Object>();
  activityMap.put("id", activity.getId());
  activityMap.put("activityTime", activity.getActivityTime());
  activityMap.put("activityField", activity.getActivityField());
  if(activity.getProject()!=null){
  activityMap.put("projectName", activity.getProject().getProjectName());
  }else{
   activityMap.put("projectName","");
  }
  if(activity.getTask()!=null){
  activityMap.put("specification",activity.getTask().getSpecification());
  }else{
   activityMap.put("specification","");
  }
  activityMap.put("user", activity.getUserByCreater().getCname());
  activityMap.put("memo", activity.getMemo());
  list.add(activityMap);
 }
 josnMap.put("activities",list);
 return josnMap;
 }

json数据的格式如下图:

spring dojo EnhancedGrid 出不来数据,怎么办啊?_第1张图片 

这是为什么啊?怎么解决啊?

 

你可能感兴趣的:(spring,json,数据,dojo)