最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jQuery easyui datagrid動態(tài)查詢數(shù)據(jù)實(shí)例講解

 更新時(shí)間:2013年02月26日 16:02:27   作者:  
接下來將從前臺提交查詢條件,從MSSQL返回json數(shù)據(jù)的一個(gè)事例來講解一下datagrid動態(tài)查詢數(shù)據(jù),感興趣的你可不要錯過了哈,希望本文可以幫助到你
該插件組小巧使用方便,以下是一個(gè)從前臺提交查詢條件,從MSSQL返回json數(shù)據(jù)的一個(gè)事例
HTML前端代碼
復(fù)制代碼 代碼如下:

<?php
include_once("auth.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="/inc/js/EasyUI/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/inc/js/EasyUI/themes/icon.css">
<script type="text/javascript" src="/inc/js/EasyUI/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="/inc/js/EasyUI/jquery.easyui.min.js"></script>
<script>
function FindData(){
$('#mytable').datagrid('load',{
PersonCode:$('#PersonCode').val(),
KQYM:$('#KQYM').val()}
);
}
</script>
</head>
<body>
<table id='mytable' class="easyui-datagrid" style="width:600px;height=500px"
url="loadgriddata_get.php" title="請輸入查詢條件"
rownumbers="true" toolbar="#searchtool" loadMsg="正在查詢...">
<thead>
<tr>
<th field="PersonCode" Width="80">工號</th>
<th field="MyName" width="80">姓名</th>
<th field="KQDate" width="100">考勤日期</th>
<th field="MyWeek" width="80">星期</th>
<th field="KQMemo" width="200">打卡時(shí)間</th>
</tr>
</thead>
</table>

<div id="searchtool" style="padding:5px">
<span>工號:</span><input type="text" id="PersonCode" value="" size=10 />
<span>考勤年月:</span><input type="text" id="KQYM" value="" size=10 />
&nbsp;&nbsp;<a href="javascript:FindData()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查詢</a>
<div>
</body>
</html>

以下是取數(shù)據(jù)集,并將數(shù)據(jù)組裝成json對象返回給前臺的php代碼
復(fù)制代碼 代碼如下:

<?php
include_once("auth.php");
include_once("inc/ms_conn.php");
include_once("inc/comm_function.php");
$PersonCode=$_POST["PersonCode"]; //前端傳來的參數(shù)
$KQYM=$_POST["KQYM"];
$sqlstr="Exec dbo.HR_Prg_GetPersonYMKQ2 '$KQYM','$PersonCode'";
$rs =mssqlquery($sqlstr); //自定義的mssql方法,類擬mssql_query方法
$row = mssql_num_rows($rs); //取行總行數(shù)
$result["total"] = $row;
$items =array();
while ($row = mssql_fetch_array($rs)){
foreach($row as $key=>$value){
//這里很重要,php的json_encode只支持utf-8,否則含漢字字段值會被置為null
&nbsp;$row[$key]=iconv('gb2312','UTF-8',$row[$key]); }
&nbsp;array_push($items, $row); }
&nbsp;$result["rows"] =$items;
&nbsp;echo json_encode($result);
?>

以下為效果圖

相關(guān)文章

最新評論

兴化市| 鄂托克旗| 万源市| 孝昌县| 竹山县| 寿阳县| 黔东| 泰顺县| 桂东县| 新余市| 渝北区| 竹溪县| 呼图壁县| 上虞市| 武定县| 五华县| 乌恰县| 泾源县| 梅州市| 两当县| 延安市| 师宗县| 阿瓦提县| 逊克县| 巴马| 河北区| 毕节市| 张家港市| 芜湖县| 东莞市| 河北区| 博客| 安图县| 肇州县| 金湖县| 宜宾县| 平山县| 枝江市| 桦南县| 山阴县| 巨野县|