2017-03-24 5 views
-1

제목에 쓰여 있으므로 입력 중에 자동 검색을 검색하려면 도구 모음에서 검색을 변경해야합니다. 여기 내 코드입니다. 내 고객이 false에 필터 표시 줄의 searchOnEnter 옵션을 설정하는도구 모음에서 jqgrid aouto 검색

<?php 
require_once 'jq-config.php'; 
// include the jqGrid Class 
require_once ABSPATH."php/PHPSuito/jqGrid.php"; 
// include the driver class 
require_once ABSPATH."php/PHPSuito/DBdrivers/jqGridPdo.php"; 
// Connection to the server 
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); 
// Tell the db that we use utf-8 
$conn->query("SET NAMES utf8"); 


// Create the jqGrid instance 
$grid = new jqGridRender($conn); 
// Data from this SQL is 1252 encoded, so we need to tell the grid 
// Set the SQL Data source 
$table = 'users'; 
$grid->SelectCommand ='SELECT id, balance, userName, userPass, userEmail, 
status, City, dateOfBirth, registrationDate, tvs, guestMod, phone1, phone2 
FROM '.$table; 

// set the ouput format to XML 
$grid->dataType = 'json'; 
// Let the grid create the model 
$grid->setPrimaryKeyId("id"); 
$grid->setColModel(); 
$grid->table = $table; 

// set labels in the header 
$grid->setColProperty("id", 
array("width"=>"20","label"=>"ID","editable"=>false, "key"=>true)); 
$grid->setColProperty("balance", array("width"=>"20","label"=>"Balance")); 
$grid->setColProperty("userName", array("width"=>"40","label"=>"User 
Name"));  
$grid->setColProperty("userPass", array("width"=>"30","label"=>"User 
Password")); 
$grid->setColProperty("userEmail", array("width"=>"50","label"=>"User 
Email")); 
$grid->setColProperty("status", array("width"=>"20","label"=>"Status")); 
$grid->setColProperty("City", array("width"=>"30","label"=>"City")); 
$grid->setColProperty("dateOfBirth", array("width"=>"30","label"=>"Date Of 
Birth")); 
$grid->setColProperty("registrationDate", 
array("width"=>"50","label"=>"Registration 
Date","formatter"=>"datetime","formatoptions"=>array("srcformat"=>"Y-m- 
d","newformat"=>"Y-m-d"))); 
$grid->setColProperty("tvs", array("width"=>"20","label"=>"Tvs")); 
$grid->setColProperty("guestMod", array("width"=>"20","label"=>"Guest 
Mod")); 
$grid->setColProperty("phone1", array("width"=>"25","label"=>"phone 1")); 
$grid->setColProperty("phone2", array("width"=>"25","label"=>"phone 2")); 




// Date options to edit 
$grid->setUserDate("Y-m-d"); 
$grid->setUserTime("Y-m-d"); 

$grid->setDatepicker('registrationDate'); 

$grid->datearray = array("registrationDate"); 

// we set the select for ship city 

$grid->setSelect("guestMod", "SELECT DISTINCT guestMod, guestMod AS guestMod 
FROM users ORDER BY id", false, false, true, array(""=>"All")); 
$grid->setSelect("City", "SELECT DISTINCT City, City AS City FROM users 
ORDER BY id", false, false, true, array(""=>"All")); 


// Set the url from where we obtain the data 
$grid->setUrl('grid.php'); 
// Set some grid options 
$grid->setGridOptions(array("rowNum"=>10,"rowList"=>array(10,20,30),"sortname"=>"id","hoverrows"=>true , "width"=>"1500","height"=>"500")); 
// Enable toolbar searching 
$grid->toolbarfilter = true; 


$grid->navigator = true; 
$grid->setNavOptions('navigator', 
array("excel"=>false,"add"=>false,"edit"=>true,"del"=>true,"view"=>true, 
"search"=>true)); 



$buttonoptions = array("#pager", 
array("caption"=>"Csv", "title"=>"Export to CSV", "onClickButton"=>"js: 
function(){ 
    jQuery('#grid').jqGrid('exportToCsv');}" 
) 
); 
$grid->callGridMethod("#grid", "navButtonAdd", $buttonoptions); 
$buttonoptions = array("#pager", 
array("caption"=>"Excel", "title"=>"Export to Escel", "onClickButton"=>"js: 
function(){ 
    jQuery('#grid').jqGrid('exportToExcel');}" 
) 
); 
$grid->callGridMethod("#grid", "navButtonAdd", $buttonoptions); 
$buttonoptions = array("#pager", 
array("caption"=>"Pdf", "title"=>"Export to PDF", "onClickButton"=>"js: 
function(){ 
    jQuery('#grid').jqGrid('exportToPdf');}" 
) 
); 
$grid->callGridMethod("#grid", "navButtonAdd", $buttonoptions); 



// Close the dialog after editing 
$grid->setNavOptions('edit',array(
"closeAfterEdit"=>true, 
"height"=>"auto", 
"dataheight"=>"auto", 
"template"=>$template, 
"editCaption"=>"Update Customer", 
"bSubmit"=>"Update" 
)); 


$grid->setFilterOptions(array("stringResult"=>true)); 
// Enjoy 
$grid->renderGrid('#grid','#pager',true, null, null, true,true); 

?> 
+0

필터 막대의'searchOnEnter' 옵션을'false'로 설정하십시오. '$ grid-> setFilterOptions (array ("stringResult"=> true, "searchOnEnter"=> false)); ' – Oleg

+0

와 같은 문제를 해결해 주셔서 감사합니다. – musa94

답변

0

시도를 요구하기 때문에 내가이 필요 행복이 작동합니다. 예 :

$grid->setFilterOptions(array("stringResult"=>true,"searchOn‌​Enter"=>false));