当前位置 博文首页 > wusq的博客:EasyUI下拉框Combobox设置某些选项不可选置灰

    wusq的博客:EasyUI下拉框Combobox设置某些选项不可选置灰

    作者:[db:作者] 时间:2021-07-16 13:10

    效果图:

    方法: 数据里面的加一项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>

    ?

    cs
    下一篇:没有了