EasyUI 动态更改选项 'required'
EasyUI change option 'required' dynamically
在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?
更改 'required' 选项不重绘组件 :(
<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>
在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? 更改 'required' 选项不重绘组件 :(
<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>