zoukankan      html  css  js  c++  java
  • Easyui 合并单元格

    onMyLoadSuccessText: function () {

    $(".datagrid-row").mouseover(function () {
    var titlestr = $(this).find("div").html();
    var tbody = $(this).parent();
    tbody.children("tr").each(function () {
    if ($(this).find("div").html() == titlestr) {
    //$(this).children().eq(0).css("background", "#eaf2ff");
    $(this).children().eq(0).addClass("datagrid-row-over");
    }
    });
    });
    $(".datagrid-row").mouseout(function () {
    var titlestr = $(this).find("div").html();
    var tbody = $(this).parent();
    tbody.children("tr").each(function () {
    if ($(this).find("div").html() == titlestr) {
    //$(this).children().eq(0).css("background", "#ffffff");
    $(this).children().eq(0).removeClass("datagrid-row-over");
    }
    });
    });

    var arr = [{ mergeFiled: "Title", premiseFiled: "Title" }];

    //var dg = $("#text"); //要合并的datagrid中的表格id
    var dg = $(this);
    var rowCount = dg.datagrid("getRows").length;
    var cellName;
    var span;
    var perValue = "";
    var curValue = "";
    var perCondition = "";
    var curCondition = "";
    var flag = true;
    var condiName = "";
    var length = arr.length - 1;
    for (i = length; i >= 0; i--) {
    cellName = arr[0].mergeFiled;
    condiName = arr[0].premiseFiled;
    if (Access.isNotNull(condiName)) {
    flag = false;
    }
    perValue = "";
    perCondition = "";
    span = 1;
    for (row = 0; row <= rowCount; row++) {
    if (row == rowCount) {
    curValue = "";
    curCondition = "";
    } else {
    curValue = dg.datagrid("getRows")[row][cellName];
    if (!flag) {
    curCondition = dg.datagrid("getRows")[row][condiName];
    }
    }
    if (perValue == curValue && (flag || perCondition == curCondition)) {
    span += 1;
    } else {
    var index = row - span;
    dg.datagrid('mergeCells', {
    index: index,
    field: cellName,
    rowspan: span,
    colspan: null
    });
    span = 1;
    perValue = curValue;
    if (!flag) {
    perCondition = curCondition;
    }
    }
    }
    }
     
    }

  • 相关阅读:
    mybatis-plus中使用FIND_IN_SET函数
    配置devtools热部署
    clickhouse20.12.3参数配置
    mysql5.7的sys系统库应用示例
    单独的线程上创建和显示WPF窗口
    DataGrid 中Combox的使用
    DataGridColumn普通样式和编辑样式
    WPF分辨率适配
    C# 上传文件添加其他参数
    C# 上传文件添加附加参数
  • 原文地址:https://www.cnblogs.com/wjwj/p/7562646.html
Copyright © 2011-2022 走看看