jQuery EasyUI 數(shù)據(jù)網(wǎng)格 – 添加復(fù)選框

2022-06-08 16:11 更新

jQuery EasyUI 數(shù)據(jù)網(wǎng)格 - 添加復(fù)選框

本節(jié)將介紹jQuery EasyUI數(shù)據(jù)網(wǎng)格中復(fù)選框的添加。

下述的實例演示如何放置一個復(fù)選框列到數(shù)據(jù)網(wǎng)格(DataGrid)。通過復(fù)選框,用戶將可以選擇“選中/取消選中”網(wǎng)格行數(shù)據(jù)。

為了添加一個復(fù)選框列,我們僅僅需要添加一個列的checkbox屬性,并設(shè)置它為true。代碼如下所示:

	<table id="tt" title="Checkbox Select" class="easyui-datagrid" style="width:550px;height:250px" url="data/datagrid_data.json" 			idField="itemid" pagination="true" iconCls="icon-save">
		<thead>
			<tr>
				<th field="ck" checkbox="true"></th>
				<th field="itemid" width="80">Item ID</th>
				<th field="productid" width="80">Product ID</th>
				<th field="listprice" width="80" align="right">List Price</th>
				<th field="unitcost" width="80" align="right">Unit Cost</th>
				<th field="attr1" width="100">Attribute</th>
				<th field="status" width="60" align="center">Status</th>
			</tr>
		</thead>
	</table>

以上代碼添加了一個帶有checkbox屬性的列,所以它將成為復(fù)選框列。如果idField屬性已設(shè)置,數(shù)據(jù)網(wǎng)格(DataGrid)的選擇集合將在不同的頁面保持。

下載 jQuery EasyUI 實例

jeasyui-datagrid-datagrid10.zip

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

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號