Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ect)。看看我们的jsonReader设置。var jsonData=new{pageIndex=pageIndex+1,pageCount=pageCount,totalCount=totalCount,data=data.ToArray();返回Js_Javascript_Jquery_Asp.net Mvc_Jqgrid - Fatal编程技术网

Javascript ect)。看看我们的jsonReader设置。var jsonData=new{pageIndex=pageIndex+1,pageCount=pageCount,totalCount=totalCount,data=data.ToArray();返回Js

Javascript ect)。看看我们的jsonReader设置。var jsonData=new{pageIndex=pageIndex+1,pageCount=pageCount,totalCount=totalCount,data=data.ToArray();返回Js,javascript,jquery,asp.net-mvc,jqgrid,Javascript,Jquery,Asp.net Mvc,Jqgrid,ect)。看看我们的jsonReader设置。var jsonData=new{pageIndex=pageIndex+1,pageCount=pageCount,totalCount=totalCount,data=data.ToArray();返回Json(jsonData)-这样我们就创建了一个用于序列化的anon对象。 public ActionResult GridData() { List<Customer> list = new List<Custome


ect)。看看我们的jsonReader设置。
var jsonData=new{pageIndex=pageIndex+1,pageCount=pageCount,totalCount=totalCount,data=data.ToArray();返回Json(jsonData)-这样我们就创建了一个用于序列化的anon对象。
public ActionResult GridData()
{

    List<Customer> list = new List<Customer>();
    list.Add(new Customer() { Code = "AAA", FirstName = "BBB", LastName = "CCC" });

    return Json(list);
}
<table id="jqgProducts" cellpadding="0" cellspacing="0"></table>
<div id="jqgpProducts" style="text-align:center;"></div>

<script type="text/javascript">
    $(document).ready(function () {
        $('#jqgProducts').jqGrid({
            //url from wich data should be requested
            url: '/Customer/GridData/',
            //type of data
            datatype: 'json',
            //url access method type
            mtype: 'GET',
            //columns names
            colNames: ['Id', 'LastName','FirstName', 'Code'],
            //columns model
            colModel: [
                  { name: 'Id', index: 'Id', align: 'left' },
                  { name: 'LastName', index: 'LastName', align: 'left' },
                  { name: 'FirstName', index: 'FirstName', align: 'left' },
                  { name: 'Code', index: 'Code', align: 'left' }
                ],
            //pager for grid
            pager: $('#jqgpProducts'),
            //number of rows per page
            rowNum: 10,
            //initial sorting column
            sortname: 'Id',
            //initial sorting direction
            sortorder: 'asc',
            //we want to display total records count
            viewrecords: true
        });
    }); 
</script>
public ActionResult GridData()
{  
    List<Customer> list = new List<Customer>();
    list.Add(new Customer() { Code = "AAA", FirstName = "BBB", LastName = "CCC" });

    return Json(list, JsonRequestBehavior.AllowGet);
}
public ActionResult GridData()
List<Customer> list = new List<Customer>();
list.Add(new Customer() { Code = "AAA", FirstName = "BBB", LastName = "CCC" });

var GetData = new
                {
                    rows = (from x in list 
                            select new JqGridRow()
                            {
                                cell = new string[] {
                                    x.Code.ToString(),
                                    x.FirstName.ToString(),
                                    x.LastName .ToString(),
                                }
                            }
                            ).ToArray()
                };

return Json(GetData , JsonRequestBehavior.AllowGet);
public ActionResult GridData() {
    var list = new List<Customer> {
        new Customer {Id = "myid1", Code = "AAA", FirstName = "BBB", LastName = "CCC"}
    };

    return Json (list, JsonRequestBehavior.AllowGet);
}
jsonReader: {
    id: "Id",
    repeatitems: false,
    root: function (obj) { return obj; },
    page: function () { return 1; },
    total: function () { return 1; },
    records: function (obj) { return obj.length; }
}
public ActionResult GridData() {
    var list = new List<Customer> {
        new Customer {Id = "myid1", Code = "AAA", FirstName = "BBB", LastName = "CCC"}
    };
    return Json (new {
        page = 1,
        total = 1,
        records = list.Count,
        rows = (from x in list
                orderby x.Id
                select new {
                    id = x.Id,
                    cell = new[] {
                        x.Code,
                        x.FirstName,
                        x.LastName
                    }
                }
        )
    }, JsonRequestBehavior.AllowGet);
}
public ActionResult GridData (string sidx, string sord, int page, int rows)