我是 jqGrid 的初学者,我想实现内联编辑并编写以下代码:
var gridDocument = jQuery("#listDocument");
gridDocument.jqGrid({
url: 'jQGridHandler.ashx',
postData: { ActionPage: 'ClearanceRequestDocument', Action: 'Fill', RequestId: '3' },
ajaxGridOptions: { cache: false },
loadonce: true,
direction: "rtl",
datatype: 'json',
height: '490',
colNames: ['DocumentNO', 'Documentname', 'OrginalCertificate', ' CopyCertificate', 'Remark'],
colModel: [
{ name: 'DOCUMENT_ID', width: 200, sortable: true, hidden: true },
{ name: 'DOCUMENT_NAME', width: 200, sortable: true, editable: false },
{
name: 'Orignal', width: 80, fixed: true, align: 'center', resizable: false, sortable: false,
formatter: function (cellValue, option, rowObject) {
return '<input id="t2" type="radio" name="radio_' + rowObject + '" />';
}
},
{
name: 'Copy', width: 80, fixed: true, align: 'center', resizable: false, sortable: false,
formatter: function (cellValue, option, rowObject) {
return '<input id="t1" type="radio" name="radio_' + rowObject + '" />';
}
},
// { name: 'is_ORGINAL', width: 80, sortable: true, editable: true, formatter: 'checkbox', edittype: 'checkbox', editoptions: { value: 'Yes:No', defaultValue: 'Yes'} },
//{ name: 'is_copy', width: 80, sortable: true, editable: true, formatter: 'checkbox', edittype: 'checkbox', editoptions: { value: 'Yes:No', defaultValue: 'Yes'} },
{ name: 'REMARK', width: 200, sortable: true, editable: false }
],
sortname: 'DOCUMENT_ID',
viewrecords: true,
rownumbers: true,
sortorder: "desc",
editurl: 'clientArray',
altRows: true,
altclass: 'ui-priority-secondary',
onSelectRow: function (id) {
if (id && id !== lastSel) {
gridDocument.saveRow(lastSel, true, 'clientArray');
gridDocument.jqGrid('restoreRow', lastSel);
gridDocument.jqGrid('editRow', id, true, null, null, 'clientArray');
lastSel = id;
intArray[index] = id;
index += 1;
}
},
pager: '#pagerDocument',
rowNum: 30,
rowList: [30, 60, 90],
loadComplete: function () {
var $this = $(this), ids = $this.jqGrid('getDataIDs'), i, l = ids.length;
for (i = 0; i < l; i++) {
$this.jqGrid('editRow', ids[i], true);
}
}
}).jqGrid('navGrid', '#pagerDocument', { edit: false, add: false, del: false, search: false, refresh: false });
我这个网格我有 2 个单选按钮列。我希望用户确定此证书提供的证据是原始的还是复制的,我尝试通过此代码获取值单选按钮(选中或未选中)
for (var i = 0; i < $("#listDocument").getGridParam("reccount") ; i++) {
var row = $("#listDocument").jqGrid('getRowData', i + 1);
alert($(row.Orignal).is(":checked") + "|" + row.Copy);
}
此代码总是警告错误值,请帮助我编写此代码,谢谢所有专家。