spring dojo EnhancedGrid 出不來數據,怎麼辦啊?

個人jsp以下: css

<%@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"; html

/*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});
   }
});
  java

    /*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" }
    ]]; json

    /*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')); app

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

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

後臺的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;
 } ui

json數據的格式以下圖: url

 

這是爲何啊?怎麼解決啊? .net

相關文章
相關標籤/搜索