EasyUI更改选项' required'动态

时间:2017-03-29 00:29:55

标签: combobox required jquery-easyui

in html:

 <input id="iCheck" 
    class="easyui-switchbutton"
    data-options="onChange:iCheckChange"
 >
 <input id="iCombo"
    class="easyui-combobox"
    data-options="mode:'remote'
                , disabled: true
                , required: false
                , loader: ...
                "
  >
脚本

中的

function iCheckChange(aChecked){
  $('#iCombo').combobox(aChecked?'enable':'disable').combobox('options').required = aChecked;
};

代码:https://jsfiddle.net/0dbog4of/4/

如何将iCombo重新整理为iCombo2? 改变所需的&#39;选项不要重绘组件:(

1 个答案:

答案 0 :(得分:0)

<script>  
  function iCheckChange(aChecked){
   $('#iCombo').combobox(aChecked?'enable':'disable');
   $('#iCombo').combobox('options').required = aChecked;
   $('#iCombo').combobox('textbox').validatebox('options').required = aChecked;
   $('#iCombo').combobox('validate');
};
</script>

http://www.jeasyui.com/forum/index.php?topic=6593.0