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

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

 更新時間:2013年02月26日 16:02:27   作者:  
接下來將從前臺提交查詢條件,從MSSQL返回json數(shù)據(jù)的一個事例來講解一下datagrid動態(tài)查詢數(shù)據(jù),感興趣的你可不要錯過了哈,希望本文可以幫助到你
該插件組小巧使用方便,以下是一個從前臺提交查詢條件,從MSSQL返回json數(shù)據(jù)的一個事例
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">打卡時間</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)文章

最新評論

和龙市| 明光市| 定西市| 义乌市| 永济市| 武陟县| 嘉禾县| 泸定县| 青田县| 夏河县| 和平县| 苏州市| 咸阳市| 明水县| 海丰县| 虞城县| 高雄县| 大城县| 会东县| 芦山县| 平山县| 砀山县| 淮南市| 石台县| 凌源市| 孝义市| 东港市| 桦川县| 依安县| 如东县| 北安市| 浏阳市| 绩溪县| 洛浦县| 连山| 南涧| 昌平区| 竹北市| 曲水县| 镇赉县| 神农架林区|