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自定義獲取編輯中單元格的值-創(chuàng)新互聯(lián)
當(dāng)前URL:http://m.rwnh.cn/article48/dcdsep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、搜索引擎優(yōu)化、動(dòng)態(tài)網(wǎng)站、網(wǎng)站維護(hù)、用戶體驗(yàn)、網(wǎng)站改版
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容