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