多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

中國最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2

jqueryeasyui教程

jQuery EasyUI 教程

jEasyUI 應用

jEasyUI 拖放

jEasyUI 菜單與按鈕

jEasyUI 布局

jEasyUI 數據網格

jEasyUI 窗口

jEasyUI 樹形菜單

jEasyUI 表單

jEasyUI 參考手冊

jQuery EasyUI 數據網格 – 添加查詢功能

閱讀 (2234)

jQuery EasyUI 數據網格 - 添加查詢功能

本實例演示如何從數據庫得到數據,并將它們顯示在數據網格(datagrid)中。然后演示如何根據用戶輸入的搜索關鍵詞搜尋顯示結果。

創建數據網格(DataGrid)

創建帶有分頁功能的數據網格(datagrid),然后添加工具欄到其中。

	<table id="tt" class="easyui-datagrid" style="width:600px;height:250px" 			url="datagrid24_getdata.php" toolbar="#tb" 			title="Load Data" iconCls="icon-save" 			rownumbers="true" pagination="true">
		<thead>
			<tr>
				<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="150">Attribute</th>
				<th field="status" width="60" align="center">Stauts</th>
			</tr>
		</thead>
	</table>

工具欄定義如下:

	<div id="tb" style="padding:3px">
		<span>Item ID:</span>
		<input id="itemid" style="line-height:26px;border:1px solid #ccc">
		<span>Product ID:</span>
		<input id="productid" style="line-height:26px;border:1px solid #ccc">
		<a href="#" class="easyui-linkbutton" plain="true" onclick="doSearch()">Search</a>
	</div>

當用戶輸入查詢值并按下查詢按鈕時,'doSearch' 函數將被調用:

	function doSearch(){
		$('#tt').datagrid('load',{
			itemid: $('#itemid').val(),
			productid: $('#productid').val()
		});
	}

上面的代碼調用了 'load' 方法來加載新的數據網格(datagrid)數據。我們需要傳遞 'itemid' 和 'productid' 參數到服務器。

服務器端代碼

	include 'conn.php';
	
	$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
	$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
	$itemid = isset($_POST['itemid']) ? mysql_real_escape_string($_POST['itemid']) : '';
	$productid = isset($_POST['productid']) ? mysql_real_escape_string($_POST['productid']) : '';
	
	$offset = ($page-1)*$rows;
	
	$result = array();
	
	$where = "itemid like '$itemid%' and productid like '$productid%'";
	$rs = mysql_query("select count(*) from item where " . $where);
	$row = mysql_fetch_row($rs);
	$result["total"] = $row[0];
	
	$rs = mysql_query("select * from item where " . $where . " limit $offset,$rows");
	
	$items = array();
	while($row = mysql_fetch_object($rs)){
		array_push($items, $row);
	}
	$result["rows"] = $items;
	
	echo json_encode($result);

下載 jQuery EasyUI 實例

jeasyui-datagrid-datagrid24.zip

關閉
程序員人生
主站蜘蛛池模板: 在线亚洲观看 | 伊人成综合 | 亚洲欧美精品一区 | 最近韩国动漫hd免费观看 | 欧美日韩你懂的 | 最近中文字幕完整视频大全版 | 男女激情视频软件 | 国产a级午夜毛片 | 成人在线视频网站 | 亚洲一区二区三区精品视频 | 欧美精品三区 | 日韩美一区二区三区 | 欧美一区二区三区免费高 | 国产video| 亚洲韩国日本一级二级r级 亚洲韩精品欧美一区二区三区 | 亚洲国语 | 精品久久中文久久久 | 一级色网站 | 538亚洲欧美国产日韩在线精品 | 亚洲成人黄色在线观看 | 手机看片日韩日韩国产在线看 | 一级特黄aa毛片免费观看 | 国产成人精品视频在放 | 久久国产精品成人免费 | 欧美自拍视频在线 | 日韩一级精品视频在线观看 | 一区二区免费 | 国内精品久久久久影院老司 | 久久精品全国免费观看国产 | 亚洲一级片免费 | www国产视频| 午夜影院免费版 | 国内一区二区三区精品视频 | 国精品日韩欧美一区二区三区 | 一级毛片一级毛片一级毛片aa | 国产三级自拍视频 | 国产麻豆高清在线观看 | 欧美精品亚洲精品日韩 | 欧美成人在线视频 | 色噜噜狠狠先锋影音久久 | 法国性xxxxx极品 |