Title: radiogroup - disable method
Post by: kimmansu on December 21, 2023, 07:18:05 AM
HI jarry.
I want to dynamically disable radiogroup using JavaScript. However, the disable method does not exist. Is there any other way?
ver : EasyUI for jQuery 1.10.17
thank you.
Title: Re: radiogroup - disable method
Post by: kimmansu on December 21, 2023, 10:49:51 PM
I urgently resolved it as follows. <div class="div_input2" style="flex:2;"> <label class="textbox-label textbox-label-top" style="text-align: left;">챔버 종류</label> <div class="easyui-radiogroup mChamberType" type="text" data-options="labelPosition: 'after', tipPosition: 'bottom', width: '50%', required: true, name:'chamber_type', value: 'HMH', data: ms.mold.chamberType, onChange: function(nv, ov) { _inno.ms.mold.chgGradeOption('M', nv); }"></div> </div>
if ( ms.mold.modRow.use_yn != "D" ) { $('#formModMold .mMoldNo').textbox('readonly', true); $('#formModMold .mChamberType').radiogroup({ "data": [ { "label": " HOT", "value": "HMH", "disabled": true }, { "label": " COLD", "value": "HMC", "disabled": true } ] }); } else { $('#formModMold .mMoldNo').textbox('readonly', false); $('#formModMold .mChamberType').radiogroup({ "data": [ { "label": " HOT", "value": "HMH", "disabled": false }, { "label": " COLD", "value": "HMC", "disabled": false } ] }); }
Is there any better way? Or I'm curious about how to extend the method.
Title: Re: radiogroup - disable method
Post by: jarry on December 21, 2023, 11:57:01 PM
This is the extended methods. $.extend($.fn.radiogroup.methods, { disable: function(jq){ return jq.each(function(){ $(this).find('.radiobutton-f').radiobutton('disable'); }) }, enable: function(jq){ return jq.each(function(){ $(this).find('.radiobutton-f').radiobutton('enable'); }) } })
Usage example: $('#formModMold .mChamberType').radiogroup('disable');
Title: Re: radiogroup - disable method
Post by: kimmansu on December 22, 2023, 12:24:11 AM
lol~~~
Thanks a lot!!! Jarry~~~
|