JQGrid: Loading data into the footer row

后端 未结 2 969
轻奢々
轻奢々 2020-12-03 02:16

Are there any examples for loading data into the footer? I can\'t find any or I\'m being blocked at work.

Thanks in advance...

2条回答
  •  自闭症患者
    2020-12-03 02:48

    The answer above helps a lot. Anyway here is the way I did it in MVC.Net:

    First this attributes over the grid definition:

    footerrow: true, userDataOnFooter: true

    In the action result on the HttpPost:

            [HttpPost]
            public ActionResult GetNewMembersByDate(string date1, string date2)
            {
                List list =_reportsRepository.GetNewByDate(DateTime.Parse(date1), DateTime.Parse(date2));
    
                var amount = from p in list
                             select p.Quantity;
    
    
                var jsonData = new
                {
                    total = 1,
                    page = 1,
                    records = list.Count(),
                    userdata = new
                        {
                            Name = "Total:",
                            Quantity= amount.Sum().ToString()
                        },
                    rows = (
                            from row in list
                            select new
                            {
                                i = row.RowNumber,
                                cell = new[] {
                                    row.RowNumber.ToString(),
                                    row.Name,
                                    row.Quantity.ToString()
                                }
                            }).ToArray()
    
                };
                return Json(jsonData);
            }
    

提交回复
热议问题