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;
    }
    }
    }
    }
     
    }

  • 相关阅读:
    7月27日
    7月26日
    7月25日
    7月24日
    UI基础 选项卡
    UI基础 手势
    UI基础 小球拖拽
    UI基础 事件
    UI基础 自定义视图
    UI基础 视图控制器
  • 原文地址:https://www.cnblogs.com/wjwj/p/7562646.html
Copyright © 2011-2022 走看看