W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
本節(jié)介紹如何創(chuàng)建jQuery EasyUI的樹形下拉框(ComboTree)。
樹形下拉框是一個帶有下列樹形結(jié)構(gòu)(Tree)的下拉框(ComboBox)。它可以作為一個表單字段進(jìn)行使用,可以提交給遠(yuǎn)程服務(wù)器。
在下述的示例中,我們將要創(chuàng)建一個帶有name、address、city字段的注冊表單。city字段是一個樹形下拉框字段,在里面用戶可以下拉樹面板(tree panel),并選擇一個特定的城市。
<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>
<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;"/></td>
</tr>
</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>
從上面的代碼可以看到,我們?yōu)橐粋€名為'city'的樹形下拉框字段設(shè)置了一個url屬性,這個字段可以從遠(yuǎn)程服務(wù)器檢索樹形結(jié)構(gòu)(Tree)數(shù)據(jù)。請注意,這個字段有一個樣式名字叫'easyui-combotree',所以我們不需要寫任何的js代碼,樹形下拉框(ComboTree)字段將自動渲染。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: