jqGrid的停留在加载? [英] jqGrid stuck on loading?

查看:204
本文介绍了jqGrid的停留在加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用jQuery插件的jqGrid 与ASP.NET的MVC应用程序。

I am trying to use the JQuery plugin jqGrid with an asp .net mvc app.

我传递网格中的JSON对象在以下格式作为jqGrid的文档:

I am passing the grid a JSON object in the following format as in the jqGrid documentation:

{
    "total":1,
    "page":1,
    "records":10,
    "rows":
    	[{
    	"i":1,"cell":["foo","bar"]},
           {"i":2,"cell":["foo1","barr"]},
           {"i":3,"cell":["foo2","barrr"]}]
}

和jqGrid的设置是:

and the jqGrid is setup:

jQuery("#searchResults").jqGrid({
                    url: '/Customer/SearchResults/',
                    datatype: 'json',
                    mtype: 'GET',
                    colNames: ['Surname', 'Forename'],
                    colModel: [
                      { name: 'Surname', index: 'Surname', width: 200, align: 'left' },
                      { name: 'Forename', index: 'Forename', width: 200, align: 'left'}],
                    pager: jQuery('#pager'),
                    rowNum: 10,
                    rowList: [5, 10, 20, 50],
                    sortname: 'Id',
                    sortorder: "desc",
                    viewrecords: true,
                    imgpath: '/scripts/themes/coffee/images',
                    caption: 'My first grid'
                });

它打我的行动,但格停留在加载,任何想法,我做错了什么?

Its hitting my action but the grid is stuck on loading, any ideas what I am doing wrong??

感谢

推荐答案

如果网格停留在加载这通常意味着网格具有或者没有收到响应或该响应包含它不能用于填充数据网格。看的第一件事是响应本身,无论是在Firebug的Net选项卡或提琴手。请确保它实际上是JSON,而不是一个500错误或HTML错误消息。其次,他们非常小心注意JavaScript错误。你需要为了赶错误使用萤火虫或IE 8的调试器(你必须手动打开),否则他们可能会得到很好的隐藏; JavaScript错误不倾向于明显给用户。然后,您可以通过调用堆栈跟踪找出为什么网格不喜欢你的数据。

If the grid is "stuck on loading" that generally means that the grid has either not received a response or that the response contains data it could not used to populate the grid. The first thing to look at is the response itself, in either Firebug's Net tab or Fiddler. Make sure it is actually JSON and not a 500 error or an HTML error message. Second, they very careful attention to JavaScript errors. You will need to use Firebug or IE 8's debugger (which you must manually turn on) in order to catch the errors, because otherwise they may be well hidden; JavaScript errors do not tend to be obvious to the user. You can then trace through the call stack to figure out why the grid does not like your data.

这是说,这样做手工是一个有点痛,这就是为什么我写的扩展方法就任何IQueryable的电网建立适当格式的数据。

That said, doing this manually is a bit of a pain, which is why I wrote extension methods to create appropriately-formatted data for the grid from any IQueryable.

这篇关于jqGrid的停留在加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆