我在jqGrid的制作单选按钮,现在我想在单选按钮的单击事件禁用另一列
{ name: 'Result', index: 'Result', width: 30, editable: true, formatter: 'dynamicText',
edittype: 'custom', editoptions: { custom_element: radioelem, custom_value: radiovalue }
},
$.extend($.fn.fmatter, {
dynamicText: function (cellvalue, options, rowObject) {
var returnValue = ""
if (cellvalue == '1') {
returnValue = 'S';
}
else if (cellvalue == '3') {
returnValue = 'N/A';
}
else if (cellvalue == '2') {
returnValue = 'US';
}
return returnValue
}
});
$.extend($.fn.fmatter.dynamicText, {
unformat: function (cellValue, options, elem) {
var text = $(elem).text();
return text === ' ' ? '' : text;
}
});
从那以后,我使用的一些功能来生成单选按钮的HTML
function radioelem(value, options, rowobject) {
var sradio = '  <input type="radio" value="1" name="receivednaradio"/>';
var sradioChecked = '  <input type="radio" checked="checked" value="1" name="receivednaradio"/>';
var breakline = 'S     ';
var usradio = '<input type="radio" value="2" name="receivednaradio"/>';
var usradioChecked = '<input type="radio" checked="checked" value="2" name="receivednaradio"/>';
var endnaradio = 'US     ';
var naradio = '<input type="radio" value="3" name="receivednaradio"/>';
var naradioChecked = '<input type="radio" checked="checked" value="3" name="receivednaradio"/>';
var end = '<span>N/A</span>';
if (value == 'S') {
var radiohtml = sradioChecked + breakline + usradio + endnaradio + naradio + end;
return radiohtml;
} else if (value == 'US') {
var radiohtml = sradio + breakline + usradioChecked + endnaradio + naradio + end;
return radiohtml;
}
else if (value == 'N/A') {
var radiohtml = sradio + breakline + usradio + endnaradio + naradioChecked + end;
return radiohtml;
}
else {
return sradio + breakline + usradio + endnaradio + naradio + end;
}
}
function radiovalue(elem, operation, value) {
if (operation === 'get') {
var newValue = 0;
$(elem).each(function () {
if ($(this).is(":checked"))
newValue = this.value;
return;
});
return newValue;
} else if (operation === 'set') {
if ($(elem).is(':checked') === false) {
$(elem).filter('[value=' + value + ']').attr('checked', true);
}
}
}
我想在单选按钮的列表中禁用任何单选按钮的点击此列,
{
name: 'AuditLevel', index: 'AuditLevel', align: 'center', width: 15, editable: true, edittype: 'select',
editoptions: { value: { value: " : ;1:Level1; 2:Level2;3: Level3" } }
},