• 展开/收缩 ul


    了一个展开收缩的东东,留着以后万一用到

    后台递归生成的函数(这里是一个反射参数展示,支持多层级展开显示,后台反射如何多层级解析的方法有时间再补上吧)

    /// <summary>
    /// 递归生成html展示request属性
    /// </summary>
    /// <param name="listProperties">request属性集合</param>
    /// <returns>html</returns>
    public static string OutputRequest(List<PropertyViewModel> listProperties)
    {
    const string contractImg = "<img src="../Cake/Easyui/themes/icons/edit_remove.png" width="16px" height="16px" border="0px" style="vertical-align: middle" />";
    const string output = "<table><tbody>{0}</tbody></table>";
    var html = new StringBuilder();
    if (listProperties == null || listProperties.Count <= 0) return string.Empty;

    foreach (var propertyOrField in listProperties)
    {
    var tr = new StringBuilder();
    tr.AppendFormat("<tr>");
    if (propertyOrField.Type.Properties != null && propertyOrField.Type.Properties.Count > 0)
    tr.AppendFormat("<td class="onclick">{1}&nbsp;&nbsp;{0}</td>", propertyOrField.Name, contractImg);
    else
    tr.AppendFormat("<td>{0}</td>", propertyOrField.Name);
    tr.AppendFormat("<td>[{0}]</td>", propertyOrField.Type.Name.EscapeSequence());//特殊字符转移 用于前端html展示
    tr.AppendFormat("<td>{0}</td>", propertyOrField.Summary);
    tr.AppendFormat("</tr>");
    html.Append(tr);
    if (propertyOrField.Type.Properties != null && propertyOrField.Type.Properties.Count > 0)
    html.AppendFormat("<tr class="expand"><td style="padding-left:30px" colspan="3">{0}</td></tr>", OutputRequest(propertyOrField.Type.Properties));
    }
    return string.Format(output, html);
    }

  • 相关阅读:
    Activiti系列——如何在eclipse中安装 Activiti Designer插件
    C语言 二维数组与指针笔记
    Ubuntu linux设置从当前目录下加载动态库so文件
    Ubuntu14.04安装nfs服务器
    Ubuntu14.04 搭建FTP服务器
    Linux备忘命令
    Java实现对xml文件的增删改查
    Java利用jacob实现打印Excel文件
    git操作列表
    swiper 窗口宽度变化,页面宽度高度变化 导致自动滑动 解决方案
  • 原文地址:https://www.cnblogs.com/maomaokuaile/p/4309143.html
Copyright © 2020-2023  润新知