zoukankan      html  css  js  c++  java
  • jgGrid数据格式

         sb.Append(string.Concat("{\"page\":", page, ","));
                sb.Append(string.Concat("\"total\":", Math.Ceiling((decimal)soListSorted.Count / rows), ","));
                sb.Append(string.Concat("\"records\":", soListSorted.Count, ","));
                sb.Append("\"rows\":[");
                foreach (SalesOrder so in soListSorted)
                {
                    sb.Append(string.Concat("{\"id\":\"", so.Id, "\","));
                    //sales order id
                    sb.Append(string.Concat("\"cell\":[\"", so.Id, "\","));
                    //sales order external id 
                    sb.Append(string.Concat("\"", so.ExternalId, "\","));
                    //summary
                    sb.Append(string.Concat("\"", so.Summary, "\","));
                    //creater
                    if (pageType.Contains("FetchToDoList"))
                        sb.Append(string.Concat("\"", so.Events[0].CreatedUser.FirstName, "\","));
                    //create date
                    sb.Append(string.Concat("\"", so.Events[0].CreatedDate.ToString(format).Substring(0, 10), "\","));
                    //last svent info               
                    sb.Append(string.Concat("\"", so.PreviousEvent.EventType.Name, " | ", so.PreviousEvent.CreatedUser.FirstName, " | ", so.PreviousEvent.CreatedDate.ToString(format), "\""));
                    sb.Append("]},");

                }
                sb.Remove(sb.Length - 1, 1);
                sb.Append("]}");
                _context.Response.Write(sb.ToString());

    ————————————————————————————————

    左后输出结果如:

    {"page":1,"total":5,"records":10,"rows":[{"id":1,"cell":["aa","aa","aa"]},

                        {"id":2,"cell":["bb","bb","bb"]},

                        {"id":3,"cell":["cc","cc","cc"]}

    ]}

  • 相关阅读:
    14个你可能不知道的JavaScript调试技巧
    数据库设计四步骤
    mac 卸载 jdk
    node版本管理
    mysql order by limit 问题
    计算机一些基本概念的认识
    SQL设置主外键关联时报错
    阻止表单autocomplete
    常见字符编码
    编程语言分类
  • 原文地址:https://www.cnblogs.com/Mac_Hui/p/1895160.html
Copyright © 2011-2022 走看看