单击RadioButton禁用下拉菜单 [英] Disable the Dropdown on clicking on RadioButton
本文介绍了单击RadioButton禁用下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在JqGrid中制作一个RadioButton,现在我想在单选按钮的click事件上禁用另一列
I am making a RadioButton in JqGrid , now i want to disable another column on the click event of radiobutton
{ 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
After that i used Some functions to generate the HTML for radioButtons
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列表中的任何单选按钮时禁用此列,
I want to disable this column on the click of any of the radiobutton in the list of RadioButtons ,
{
name: 'AuditLevel', index: 'AuditLevel', align: 'center', width: 15, editable: true, edittype: 'select',
editoptions: { value: { value: " : ;1:Level1; 2:Level2;3: Level3" } }
},
推荐答案
if (($("#radioButtonId").is(':checked')) ){
$('#AuditLavel').attr("disabled",true)
}
else
{
$('#AuditLavel').attr("disabled",false)
}
这篇关于单击RadioButton禁用下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文