 |
|
ผมสอบถามหน่อยคับ ผมใช้ easyui แล้ว ตอนแรก Search เป็น รหัสพนักงานก็หาได้ แต่อยากจะ Search ชื่อพนักงานเป็นภาษาไทย มันไม่ยอมส่งมาค่า เลยไม่แน่ใจว่าเป็นเพราะอะไร
รบกวนผู้มีความรู้ด้วย ขอขอบคุณอย่างยิ่ง 
อันฝั่ง Server ไฟล์ชื่อ get_employee.php
Code (PHP)
<?php
@header('Content-Type: text/html; charset=tis-620');
$Temp= ($_REQUEST['Temp']);
$sort = isset($_POST['sort']) ? strval($_POST['sort']) : 'EmpNum';
$order = isset($_POST['order']) ? strval($_POST['order']) : 'asc';
include'DB/conn.php';
$rs = mssql_query(" SELECT
EmpNum ,EmpName ,SurName ,Company as CompanyCheck
,isnull((convert(varchar, convert(datetime,ProbationDate),105)),'') as ProbationDate
,isnull((convert(varchar, convert(datetime,HireDate),105)),'') as HireDate
,(select company+' - '+conamedisplay from company as Co where Co.company=Emp.company) as Company
,(select Code+' - '+DescriptionEng from SetupCode as SCode where SCode.Category= 'EmpGroup' and SCode.Code=Emp.EmpGroup ) as EmpGroup
,(select OrgNum+' - '+OrgNameEng from Organization as Org where Org.OrgNum=Emp.Organize) as Organize
,(select Position+' - '+PosNameEng from Position as Pos where Pos.Position=Emp.Position)as Position
,(select Code+' - '+DescriptionEng from SetupCode as SCode where SCode.Category= 'Level' and SCode.Code=Emp.EmpLevel ) as EmpLevel
,(select DescriptionEng from SetupCode as SCode where SCode.Category= 'EmpStatus' and SCode.Code=Emp.EmpStatus ) as Status
,Emp.EmpLevel as LevelCheck
from Employee as Emp
where EmpName like '$Temp%' order by Company,$sort $order");
$result = array();
while($row = mssql_fetch_object($rs)){
$row->EmpName = iconv('tis-620','utf-8',$row->EmpName);
$row->SurName = iconv('tis-620','utf-8',$row->SurName);
$row->NameEng = iconv('tis-620','utf-8',$row->NameEng);
$row->SurNameEng = iconv('tis-620','utf-8',$row->SurNameEng);
$row->EmpGroup = iconv('tis-620','utf-8',$row->EmpGroup);
array_push($result, $row);
}
echo json_encode($result);
?>
อันนี้ฝั่ง cilent ไฟล์ ชื่อ Employee.php
Code (PHP)
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/icon.css">
<link rel="stylesheet" type="text/css" href="css/nomal.css">
<link rel="stylesheet" type="text/css" href="hr.css">
<script type="text/javascript" src="query/jquery-1.6.min.js"></script>
<script type="text/javascript" src="query/jquery.easyui.min.js"></script>
<script type="text/javascript">
function SearchEmployee(){ /* ส่วนนี้ที่ใช้ Search Employee */
$('#dg').datagrid('load',{
Temp: $('#Temp').val()
});
</script>
</head>
<body>
<table id="dg" title=" Employee" class="easyui-datagrid" style="width:1200px;height:580px" data-options="iconCls:'icon-personal',resizable:true,modal:true"
url="get_employee.php"
toolbar="#toolbar"
rownumbers="true"
singleSelect="true">
<thead data-options="frozen:true">
<tr>
<th data-options="field:'EmpNum',width:100,halign:'center',sortable:'true'"><b>Employee ID</b></th>
<th width="151" data-options="field:'EmpName',width:150,halign:'center',sortable:'true'"><b>Name</b></th>
<th width="143" data-options="field:'SurName',width:150,halign:'center',sortable:'true'"><b>SurName</b></th>
</tr>
</thead>
<thead>
<tr>
<th data-options="field:'EmpGroup',width:150,halign:'center',sortable:'true'"><b>Employee Group</b></th>
<th data-options="field:'Status',width:80,halign:'center',sortable:'true',formatter:formatStatus"><b>Status</b></th>
<th data-options="field:'Company',width:120,halign:'center',sortable:'true'"><b>Company</b></th>
<th data-options="field:'Organize',width:150,halign:'center',sortable:'true'"><b>Organize</b></th>
<th data-options="field:'Position',width:150,halign:'center',sortable:'true'"><b>Position</b></th>
<th data-options="field:'EmpLevel',width:130,halign:'center',sortable:'true'"><b>Level</b></th>
<th data-options="field:'ProbationDate',width:120,halign:'center',sortable:'true'"><b>Probation Date</b></th>
<th data-options="field:'HireDate',width:120,halign:'center',sortable:'true'"><b>Hire Date</b></th>
</tr>
</thead>
</table>
<div id="toolbar" style="padding:2px 0">
<table cellpadding="0" cellspacing="0" style="width:100%">
<tr>
<td style="padding-left:2px">
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true<? if($Insert!=1){echo ',disabled:true';}?>" onclick="newEmployee()">New </a>
<a href="#" class="easyui-linkbutton"data-options="iconCls:'icon-edit',plain:true<? if($Update!=1){echo ',disabled:true';}?>" onclick="editEmployee()">Edit </a>
</td>
<td style="text-align:right;padding-right:2px">
<input id="Temp" name="Temp" style="width:180px"> <a href="#" onClick="SearchEmployee();"class="easyui-linkbutton" iconCls="icon-search">Search</a>
</td>
</tr>
</table>
</div>
<body>
</html>
Tag : PHP, jQuery, CakePHP
|
|
 |
 |
 |
 |
Date :
2013-09-26 09:39:28 |
By :
wirunmoy |
View :
1242 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |