jqgrid没有加载数据

时间:2010-12-25 20:10:32

标签: jquery ruby-on-rails jqgrid

我有一个将json数据推送到jqgrid的RoR应用程序。网格加载,显示正确的页面/行计数,但不显示任何行。

数据:

{
"total":333,
"page":1,
"records":3333,
"rows":[
    {"id":"267","cell":["42883","Enhancing Personal and Organizational Creativity (XP)","1"]},
    {"id":"268","cell":["42883","Enhancing Personal and Organizational Creativity","1"]},
    {"id":"266","cell":["42815","Strategic Decision Making (XP-Elective)","1"]},
    {"id":"265","cell":["42811","Strategic Planning","1"]},
    {"id":"264","cell":["42809","Best Practices in Innovation (XP)","1"]},
    {"id":"260","cell":["42808","Grave to Cradle - The Basics of Restructuring and Bankruptcies","1"]},
    {"id":"261","cell":["42808","Corporate Restructuring","1"]},
    {"id":"262","cell":["42808","Grave to Cradle Corporate Restructuring","1"]},
    {"id":"263","cell":["42808","Failure  - Grave to Cradle Corporate Restructuing (XP)","1"]},
    {"id":"259","cell":["42800","Competitive Strategy  (XP)","1"]}
    ]
}

HTML:

$("#list").jqGrid({
  url:courseSource + "/fulldata?instructor=" + instrId + "&course=" + courseId,
  datatype: 'json',
  mtype: 'GET',
  colNames:['Course Number','Course Title', 'Number of Instructors'],
  colModel :[
    {name:'course_no', index:'course_no', width:200},
    {name:'name', index:'name', width:500},
    {name:'ins_count', index:'ins_count', width:260, align:'right'}
  ],
  pager: '#pager',
  rowNum:10,
  rowList:[10,20,30],
  sortname: 'course_no',
  sortorder: 'desc',
  viewrecords: true,
  caption: 'Courses'
});

任何想法?我在这里迷失了 - 我遇到了常见问题 - 在jqgrid.js之前加载了语言环境,加载了css,加载了jquery和朋友。什么在进行?

1 个答案:

答案 0 :(得分:1)

我想你在问题中发布的代码之外有一些小问题。将完整的HTML页面与the following page进行比较。它具有您的代码和您的JSON数据。你可以看到所有工作没有任何问题。因此,您描述的问题必须是已发布代码的