직접 만든 easyui 데이터gird 확장

4187 단어
var a;
$(function () {
    $("body").bind("contextmenu", function () {
        return false;
    });

    $.extend($.fn.datagrid.methods, {
        rightTools: function (jq, opts) {
            $(".datagrid-btable tbody tr td").bind("contextmenu", function () {
                return false;
            });
            $(".datagrid-btable tbody tr td").bind("mousedown", function (e) {
                if (e.which == 3) {
                    var index = $(this).parent().attr("datagrid-row-index");
                    showTools(jq, $(this), index, opts, e.clientX, e.clientY);
                };
            });
        }
    });
});

function showTools(d, b, i, o, x, y) {
    ccl();
    a = d;
    var rows = $(d).datagrid("getRows");
    var iscan = false;
    if (rows[i][o.field] == o.status) {
        iscan = true;
    };
    var s = "<div class='zzc' style='position:fixed;width:100%;height:100%;z-index:3;' onclick='ccl();' onmousedown='ccl();'>";
    s += "</div>";
    s += "<div class='tdm'>";
    s += "<table border='0' cellpadding='0' cellspacing='0'>";
    s += "<tr><td><a href=\"javascript:ViewC('" + i + "');\"> </a></td></tr>";
    s += "<tr><td><a href=\"javascript:medMain('" + i + "');\"> </a></td></tr>";
    s += "</table>";
    s += "</div>";
    $("body").append(s);
    $(".tdm").offset({ top: y, left: x });
}

function ccl() {
    $(".tdm").remove();
    $(".zzc").remove();
}
function ViewC(i) {
    $(a).datagrid('selectRow', i);
    View();
    ccl();
}

좋은 웹페이지 즐겨찾기