Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > สอบถามเรื่อง Jquery EasyUI หน่อยคับ การส่งค่าฟังก์ชั่น load ของ Datagrid



 

สอบถามเรื่อง Jquery EasyUI หน่อยคับ การส่งค่าฟังก์ชั่น load ของ Datagrid

 



Topic : 100993



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์




ผมสอบถามหน่อยคับ ผมใช้ 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="&nbsp;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







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-09-26 09:39:28 By : wirunmoy View : 1159 Reply : 3
 

 

No. 1

Guest


การใช้ jquery จะต้องเซพฐานข้อมูลเป็น utf8 ถึงจะค้นหาได้






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-26 22:20:23 By : มามา
 


 

No. 2



โพสกระทู้ ( 1,095 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


@header('Content-Type: text/html; charset=tis-620');
เปลี่ยนเป็น UTF-8 ซะ

แล้วลองใช้ฟังก์ชั่นนี้
https://www.thaicreate.com/php/forum/101014.html
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-26 22:36:56 By : compiak
 

 

No. 3

Guest


วิธีง่ายๆในการเช็คคือ ส่งค่า search มายังหน้า php เปล่าๆ แล้ว get ค่าดูว่าเป็นภาษาไทยหรือไม่ แค่นี้ก็จะรู้แล้วว่ามันผิดตรงไหน ถึงจะกำหนดเฮดเป็น utf8 แต่ถ้าตอนเซฟไม่ได้เป็น utf8 มันก็หาไม่เจอ เพราะ jquery มันจะ encode เป็น utf8 ส่งค่ามา
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-09-26 22:52:08 By : มามา
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามเรื่อง Jquery EasyUI หน่อยคับ การส่งค่าฟังก์ชั่น load ของ Datagrid
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่