easyui combobox动态默认选项设置
Posted conserdao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了easyui combobox动态默认选项设置相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <!-- 引入JQuery --> <script type="text/javascript" src="../JQuery-EasyUI-1.5.1/jquery.min.js"></script> <!-- 引入EasyUI --> <script type="text/javascript" src="../JQuery-EasyUI-1.5.1/jquery.easyui.min.js"></script> <!-- 引入EasyUI的中文国际化js,让EasyUI支持中文 --> <script type="text/javascript" src="../JQuery-EasyUI-1.5.1/locale/easyui-lang-zh_CN.js"></script> <!-- 引入EasyUI的样式文件--> <link rel="stylesheet" href="../JQuery-EasyUI-1.5.1/themes/default/easyui.css" type="text/css"/> <!-- 引入EasyUI的图标样式文件--> <link rel="stylesheet" href="../JQuery-EasyUI-1.5.1/themes/icon.css" type="text/css"/> </head> <body> <table id="dg" title="My Users" class="easyui-datagrid" style="width: 550px; height: 250px" toolbar="#toolbar" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="firstname" width="50">First Name</th> <th field="lastname" width="50">Last Name</th> <th field="phone" width="50">Phone</th> <th field="email" width="50">Email</th> </tr> </thead> </table> <div id="toolbar"> <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">New User</a> <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Edit User</a> <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">Remove User</a> </div> <div> <select id="cc" class="easyui-combobox" name="dept" style="width:200px;"> </select> </div> <script type="text/javascript"> var sq=2; $(‘#cc‘).combobox({ data:[{text:‘AAA‘,value:‘0‘,selected:true}, {text:‘BBB‘,value:‘1‘}, {text:‘CCC‘,value:‘2‘}, {text:‘DDD‘,value:‘3‘}],
onLoadSuccess:function(){
$(this).combobox(‘select‘,sq);
} }); </script> </body> </html>
以上是关于easyui combobox动态默认选项设置的主要内容,如果未能解决你的问题,请参考以下文章
Easyui Datagrid 的Combobox 如何动态修改下拉选项,以及值的转换