EasyUI下拉框Combobox设置某些选项不可选置灰

效果图:

方法: 数据里面的加一项disabled为true就可以了

data = [{
		    "id":1,
		    "text":"text1",
		    "disabled": true
		},{
			"id":2,
			"text":"text2",
			"disabled": false
		},{
			"id":3,
			"text":"text3"
		,{
			"id":4,
			"text":"text4",
			"disabled": true
		},{
			"id":5,
			"text":"text5"
		}]

完整代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/color.css">
		<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/demo/demo.css">
		<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
		<script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
		
	</head>
	<body>
		<input id="cc"  class="easyui-combobox" name="dept">
		
		
		<script>
			var data = [{
					"id":1,
					"text":"text1",
					"disabled": true
				},{
					"id":2,
					"text":"text2",
					"disabled": false
				},{
					"id":3,
					"text":"text3"
				},{
					"id":4,
					"text":"text4",
					"disabled": true
				},{
					"id":5,
					"text":"text5"
				}]
			$('#cc').combobox({
				data:data,
				valueField:'id',
				textField:'text'
			});
		</script>
	</body>
</html>

 

©️2020 CSDN 皮肤主题: 技术工厂 设计师:CSDN官方博客 返回首页