jQuery EasyUI 數(shù)據(jù)網(wǎng)格 – 創(chuàng)建復(fù)雜工具欄

2022-06-08 16:08 更新

jQuery EasyUI 數(shù)據(jù)網(wǎng)格 - 創(chuàng)建復(fù)雜工具欄

在上一節(jié)內(nèi)容中,我們學(xué)習(xí)了如何向jQuery EasyUI數(shù)據(jù)網(wǎng)格(datagrid)添加工具欄(toolbar),本節(jié),我們將繼續(xù)介紹復(fù)雜的工具欄應(yīng)該如何創(chuàng)建。

jQuery EasyUI數(shù)據(jù)網(wǎng)格的工具欄可以包含按鈕及其他組件。您可以通個(gè)一個(gè)已存在的DIV標(biāo)簽來(lái)簡(jiǎn)單地定義工具欄布局,該DIV標(biāo)簽將成為數(shù)據(jù)網(wǎng)格工具欄的內(nèi)容。

以下是如何創(chuàng)建數(shù)據(jù)網(wǎng)格組件的復(fù)雜工具欄的步驟。

創(chuàng)建工具欄(Toolbar)

	<div id="tb" style="padding:5px;height:auto">
		<div style="margin-bottom:5px">
			<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true"></a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true"></a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true"></a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-cut" plain="true"></a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true"></a>
		</div>
		<div>
			Date From: <input class="easyui-datebox" style="width:80px">
			To: <input class="easyui-datebox" style="width:80px">
			Language: 
			<input class="easyui-combobox" style="width:100px" 	url="data/combobox_data.json" 					                    valueField="id" textField="text">
			<a href="#" class="easyui-linkbutton" iconCls="icon-search">Search</a>
		</div>
	</div>

創(chuàng)建數(shù)據(jù)網(wǎng)格(DataGrid)

	<table class="easyui-datagrid" style="width:600px;height:250px" url="data/datagrid_data.json"  			
             title="DataGrid - Complex Toolbar" toolbar="#tb" singleSelect="true" fitColumns="true">
		<thead>
			<tr>
				<th field="itemid" width="60">Item ID</th>
				<th field="productid" width="80">Product ID</th>
				<th field="listprice" align="right" width="70">List Price</th>
				<th field="unitcost" align="right" width="70">Unit Cost</th>
				<th field="attr1" width="200">Address</th>
				<th field="status" width="50">Status</th>
			</tr>
		</thead>
	</table>

正如您所看到的,數(shù)據(jù)網(wǎng)格(datagrid)的工具欄域?qū)υ捒颍╠ialog)相似。我們不需要寫(xiě)任何的javascript代碼,就能創(chuàng)建帶有復(fù)雜工具欄的數(shù)據(jù)網(wǎng)格(datagrid)。

下載 jQuery EasyUI 實(shí)例

jeasyui-datagrid-datagrid19.zip

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)