获取jqgrid中的radiobutton值
我是jqGrid的初学者,我想实现内联编辑并编写以下代码:获取jqgrid中的radiobutton值,jqgrid,jqgrid-asp.net,jqgrid-php,jqgrid-formatter,jqgrid-inlinenav,Jqgrid,Jqgrid Asp.net,Jqgrid Php,Jqgrid Formatter,Jqgrid Inlinenav,我是jqGrid的初学者,我想实现内联编辑并编写以下代码: var gridDocument = jQuery("#listDocument"); gridDocument.jqGrid({ url: 'jQGridHandler.ashx', postData: { ActionPage: 'ClearanceRequestDocument', Action: 'Fill', RequestId: '3'
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 });
var gridDocument=jQuery(#listDocument”);
gridDocument.jqGrid({
url:'jQGridHandler.ashx',
postData:{ActionPage:'ClearanceRequestDocument',Action:'Fill',RequestId:'3'},
ajaxGridOptions:{cache:false},
有一次:是的,
方向:“rtl”,
数据类型:“json”,
高度:'490',
ColName:['DocumentNO','Documentname','OrginalCertificate','CopyCertificate','Remark'],
colModel:[
{name:'DOCUMENT_ID',width:200,sortable:true,hidden:true},
{name:'DOCUMENT_name',宽度:200,可排序:true,可编辑:false},
{
名称:'Orignal',宽度:80,固定:true,对齐:'center',可调整大小:false,可排序:false,
格式化程序:函数(cellValue、option、rowObject){
返回“”;
}
},
{
名称:'Copy',宽度:80,固定:true,对齐:'center',可调整大小:false,可排序:false,
格式化程序:函数(cellValue、option、rowObject){
返回“”;
}
},
//{name:'is_original',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',宽度:200,可排序:true,可编辑:false}
],
sortname:“文档\u ID”,
viewrecords:是的,
行数:对,
巫师:“描述”,
editurl:'客户端阵列',
阿尔特罗斯:是的,
altclass:“ui优先级辅助”,
OnSetrow:功能(id){
if(id&&id!==lastSel){
saveRow(lastSel,true,'clientArray');
jqGrid('restoreRow',lastSel);
jqGrid('editRow',id,true,null,null,'clientArray');
lastSel=id;
intArray[index]=id;
指数+=1;
}
},
传呼机:“#pagerDocument”,
rowNum:30,
行列表:[30,60,90],
loadComplete:函数(){
var$this=$(this),ids=$this.jqGrid('getDataIDs'),i,l=ids.length;
对于(i=0;i
我有两个单选按钮列。我希望用户确定此证书提供的证据是原始证据还是副本我尝试使用此代码获取值radioButton(选中或未选中)
for(var i=0;i<$(“#listDocument”).getGridParam(“reccount”);i++){
var row=$(“#listDocument”).jqGrid('getRowData',i+1);
警报($(row.Orignal).is(“:checked”)+“|”+row.Copy);
}
此代码总是提示错误值,请帮助我编写此代码,谢谢所有专家。如果您想根据原始值(真或假)检查单选按钮 将格式化程序函数从
formatter: function (cellValue, option, rowObject) {
return '<input id="t2" type="radio" name="radio_' + rowObject + '" />';
}
在custom_func中有两个参数passed value和colname,您可以使用这些参数来验证我希望每行只选中一个单选按钮。在validateOriginalOrCopy函数中,如何检查例如,当单击“复制”单选按钮时,首先应检查“用户已选择原始”或“否”,
formatter: function (cellValue, option, rowObject) {
return '<input id="t2" type="radio" name="radio_' + rowObject + '" />';
}
formatter: function (cellValue, option, rowObject) {
return '<input id="t2" type="radio" name="radio_' + rowObject["DOCUMENT_ID"] + '" checked="'+cellvalue+'"/>';
}
use editrules:{custom: true, custom_func: validateOriginalOrCopy}