Flexigrid没有在MVC3中显示数据

时间:2012-02-17 23:58:35

标签: jquery internet-explorer jquery-ui flexigrid

我已经开始使用Flexigrid,并且在尝试将数据显示到视图中时,它不会出现。 它不是显示,而是要求我保存视图名称的文件。 我目前正在测试IE9。 当我尝试在FF上测试时,它显示了我的json细节,看起来很好。

有什么想法吗?

<div>
<table id="userList" style="display:none"></table>
<script type="text/javascript">
@*<script src="<%: Url.Content("~/Scripts/jquery-1.4.1.min.js")%>" type="text/javascript"></script>*@
@*<script src="<%: Url.Content("~/Scripts/flexigrid/css/flexigrid.pack.css")%>" type="text/javascript"></script>
<script href="<%: Url.Content("~/Scripts/flexigrid/css/flexigrid.css")%>" rel="stylesheet type="text/css" />*@
    $(function(){
    $("#userList").flexigrid
                ({
                    url: '/User/List',
                    dataType: 'json',
                    colModel: [

                       { display: 'FirstName', name: 'FirstName', width: 200, sortable: true, align: 'left' },
            { display: 'LastName', name: 'lastName', width: 250, sortable: false, align: 'left' },

                       ],
                    searchitems: [
                       { display: 'FirstName', name: 'FirstName' },
                       { display: 'LastName', name: 'lastName' }
                       ],
                    singleSelect: true,
                    sortname: "Id",
                    sortorder: "asc",
                    usepager: true,
                    title: 'User List',
                    useRp: true,
                    rp: 10,
                    showTableToggleBtn: true,
                    width: 1260,
                    height: 350
                });
            }

 </script>

控制器:      public JsonResult List()         {             列表清单=新列表();

        var ViewModel = new ViewModel
                                {
                                    FirstName = "First",
                                    lastName = "Last",

                                };

        list.Add(ViewModel);
        FlexiGridObject flexiGridObject = new FlexiGridObject();
        flexiGridObject.page = 1;
        flexiGridObject.total = 1;
        foreach (ViewModel viewModel in list)
        {
            FlexiGridRow cell = new FlexiGridRow
                                  {
                                      id = viewModel.UserId.ToString(),
                                      cell = GetPropertyList(viewModel)
                                  };
            flexiGridObject.rows.Add(cell);
        }

        return Json(flexiGridObject,JsonRequestBehavior.AllowGet);
    }

0 个答案:

没有答案