树形下拉框是一个带有下列树形结构的下拉框。它能够做为一个表单字段进行使用,能够提交给远程服务器。javascript
在本教程中,咱们将要建立一个注册表单,带有name、address、city字段。city字段是一个树形下拉框字段,在里面用户能够下拉树面板,并选择一个特定的城市。html
jQuery EasyUI最新试用版下载请猛戳>>java

点击查看示例json
建立表单
1服务器 2post 3ui 4url 5spa 6code 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
< div id = "dlg" class = "easyui-dialog" style = "width:500px;height:250px;padding:10px 30px;" title = "Register" buttons = "#dlg-buttons" > < h2 >Account Information</ h2 > < form id = "ff" method = "post" > < table > < tbody >< tr > < td >Name:</ td > < td >< input type = "text" name = "name" style = "width:350px;" ></ td > </ tr > < tr > < td >Address:</ td > < td >< input type = "text" name = "address" style = "width:350px;" ></ td > </ tr > < tr > < td >City:</ td > < td >< select class = "easyui-combotree" url = "data/city_data.json" name = "city" style = "width:156px;" ></ select ></ td > </ tr > </ tbody ></ table > </ form > </ div > < div id = "dlg-buttons" > < a href = "#" class = "easyui-linkbutton" iconcls = "icon-ok" onclick = "savereg()" >Submit</ a > < a href = "#" class = "easyui-linkbutton" iconcls = "icon-cancel" onclick = "javascript:$('#dlg').dialog('close')" >Cancel</ a > </ div > |
从上面的代码能够看到,咱们为一个名为 'city' 的树形下拉框字段设置了一个url属性,这个字段能够从远程服务器检索树形结构数据。请注意,这个字段有一个样式名字叫 'easyui-combotree',因此咱们不须要写任何的js代码,树形下拉框字段将自动渲染。
下载EasyUI示例:easyui-form-demo.zip
有兴趣的朋友能够点击查看更多有关jQuery EasyUI的教程>>