2014-09-13 106 views
0

Jqgrid能够加载数据。但是,gviing在加载时出错。jqgrid在网格加载时出错

错误是在低于林 - 的jqGrid分钟版本:

k=b.jgrid.formatter.integer||{}unable to get property of undefined null reference

布局已包含的脚本文件如下:

 <script src='@Url.Content("~/Scripts/jqgrid/jquery-1.10.2.min.js")' type="text/javascript"></script> 
<script src='@Url.Content("~/Scripts/jqgrid/i18n/grid.locale-en.js")' type="text/javascript"></script> 
<script src='@Url.Content("~/Scripts/jqgrid/jquery.jqGrid.min.js")' type="text/javascript"></script> 

请帮我我米只是卡住了。并花了3小时... ...

我谷歌和发现了许多链接,它syas,不添加区域设置或添加它在第一线..但仍然没有得到成功。

  $('#CategoriesGrdList').jqGrid({ 
      ajaxGridOptions: { 
       error: function() { 
        $('#CategoriesGrdList')[0].grid.hDiv.loading = false; 
        alert('An error has occurred.'); 
       } 
      }, 
      url: '@Url.Action("GetAllCategoriesList", "Categories")/' + 0, 
      gridview: true, 
      autoencode: true, 
      //public JsonResult GetEnrolls(int adClassSchedID,DateTime attendanceDate,int adProgramID,int syCampusID) 
      postData: { categoryId: 1 }, 
      //postData: { categoryId: rowID, attendanceDate: $('#AttendanceDate').val(), adProgramID: $('#adProgramID').val(), syCampusID: $('#syCampusID').val() }, 
      datatype: 'json', 
      jsonReader: { root: 'List', page: 'Page', total: 'TotalPages', records: 'TotalCount', repeatitems: false, id: 'Id' }, 
      mtype: 'GET', 
      colNames: ['Id', 'Code', 'Description', 'IsActive'], 
      colModel: [ 
        { name: 'Id', index: 'Id', hidden: true }, 
       { name: 'Code', index: 'Code', width: 170 }, 
       { name: 'Description', index: 'Description', width: 170 }, 
      { name: 'IsActive', index: 'IsActive', width: 170 } 
      ], 
      pager: $('#CategoriesGrdPager'), 
      sortname: 'Code', 
      rowNum: 40, 
      rowList: [3, 3, 3], 
      width: '525', 
      height: '100%', 
      viewrecords: true, 

      beforeSelectRow: function (rowid, e) { 
       return false; 

      }, 
      sortorder: 'desc' 
     }).navGrid('#CategoriesGrdPager', { edit: false, add: false, del: false, search: false, refresh: false }); 
    }); 

感谢

+0

你的问题是什么原因? – Oleg 2014-09-15 06:02:13

回答

0

首先你应该总是在jqGrid的内部一些错误的情况下使用jquery.jqGrid.src.js,而不是jquery.jqGrid.min.js的。

我想这个错误的原因是缺少grid.locale-en.jsi18n文件夹中的其他语言特定的文件。语言文件应包括jquery.jqGrid.min.jsjquery.jqGrid.src.js之前。您应该验证grid.locale-en.js是否为真的加载。未定义$.jgrid.formatter可能意味着只能缺少grid.locale-en.js(请参阅here)。

我建议您从jqGrid文档中比较您的HTML文件(特别是<head>部分)和the demo HTML file