我在JqGrid中制作一个RadioButton,现在我想在radiobutton的click事件上禁用另一个列
{ 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;
}
});
之后我使用了一些函数来生成radioButtons的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);
}
}
}
我想在单击RadioButtons列表中的任何radiobutton时禁用此列,
{
name: 'AuditLevel', index: 'AuditLevel', align: 'center', width: 15, editable: true, edittype: 'select',
editoptions: { value: { value: " : ;1:Level1; 2:Level2;3: Level3" } }
},
答案 0 :(得分:0)
if (($("#radioButtonId").is(':checked')) ){
$('#AuditLavel').attr("disabled",true)
}
else
{
$('#AuditLavel').attr("disabled",false)
}