资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

JqGrid自定义获取编辑中单元格的值-创新互联

用法: JqGrid自定义获取编辑中单元
格的值
var grid = $("#jqGrid");
var cellvalue =grid .jqGrid("getEditingCellValue", grid [0], rowId, iRow, iCol);
$.jgrid.extend({ getEditingCellValue: function (grid, rowId, iRow, iCol) { var $t = grid, fr, errors = $.jgrid.getRegional(grid, 'errors'), edit = $.jgrid.getRegional(grid, 'edit'); if (fr !== null) { var cc = $("td:eq(" + iCol + ")", $t.rows[iRow]), v, v2, cm = $t.p.colModel[iCol], nm = cm.name, nmjq = $.jgrid.jqID(nm), p = $(cc).offset(); switch (cm.edittype) { case "select": if (!cm.editoptions.multiple) { v = $("#" + rowId + "_" + nmjq + " option:selected", $t.rows[iRow]).val(); v2 = $("#" + rowId + "_" + nmjq + " option:selected", $t.rows[iRow]).text(); } else { var sel = $("#" + rowId + "_" + nmjq, $t.rows[iRow]), selectedText = []; v = $(sel).val(); if (v) { v.join(","); } else { v = ""; } $("option:selected", sel).each( function (i, selected) { selectedText[i] = $(selected).text(); } ); v2 = selectedText.join(","); } if (cm.formatter) { v2 = v; } break; case "checkbox": var cbv = ["Yes", "No"]; if (cm.editoptions) { cbv = cm.editoptions.value.split(":"); } v = $("#" + rowId + "_" + nmjq, $t.rows[iRow]).is(":checked") ? cbv[0] : cbv[1]; v2 = v; break; case "password": case "text": case "textarea": case "button": v = $("#" + rowId + "_" + nmjq, $t.rows[iRow]).val(); v2 = v; break; case 'custom': try { if (cm.editoptions && $.isFunction(cm.editoptions.custom_value)) { v = cm.editoptions.custom_value.call($t, $(".customelement", cc), 'get'); if (v === undefined) { throw "e2"; } else { v2 = v; } } else { throw "e1"; } } catch (e) { if (e === "e1") { $.jgrid.info_dialog(errors.errcap, "function 'custom_value' " + edit.msg.nodefined, edit.bClose, { styleUI: $t.p.styleUI }); } else if (e === "e2") { $.jgrid.info_dialog(errors.errcap, "function 'custom_value' " + edit.msg.novalue, edit.bClose, { styleUI: $t.p.styleUI }); } else { $.jgrid.info_dialog(errors.errcap, e.message, edit.bClose, { styleUI: $t.p.styleUI }); } } break; } } return v2; } });
网页题目:JqGrid自定义获取编辑中单元格的值-创新互联
本文网址:http://cdkjz.cn/article/dcdsep.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220