如何从jqgrid获取过滤器数组

时间:2013-03-28 11:23:19

标签: php jqgrid

我正在使用这个php代码生成一个网格。

<?php

//ini_set("display_errors","1");
require_once 'grid/jq-config.php';
// include the jqGrid Class
require_once "grid/jqGrid.php";
// include the driver class
require_once "grid/jqGridArray.php";

// include the calendar
require_once "grid/jqCalendar.php"; 

// include the document class 
require_once "lib/document.php";
// include heler.php which contain some helper functions
require_once "lib/helper.php";
// create the array connection
$conn = new jqGridArray();
// Create the jqGrid instance
$grid = new jqGridRender($conn);


echo $_REQUEST["filters"]; 

我希望当用户按工具栏搜索时,通过$ _REQUEST变量进行参数搜索并传递给我的函数并返回新结果。

echo $_REQUEST["filters"];

的结果
{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"BatchNumber\",\"op\":\"bw\",\"data\":\"56\"},{\"field\":\"SenderCode\",\"op\":\"bw\",\"data\":\"string1\"},{\"field\":\"ReceiverCode\",\"op\":\"bw\",\"data\":\"string2\"}]}{"records":0,"page":0,"total":0,"rows":false}

我希望结果像

$filter = array("BatchNumber" => 56 , 
"SenderCode" => "string1",
"ReceiverCode" => "string2"
 )

还有其他字段我想在其中搜索并显示在上面的数组中。

1 个答案:

答案 0 :(得分:0)

如果我正确理解您的问题,您应该将stringResult的{​​{1}}属性值从true更改为false。选项stringResult: true使发送到服务器的信息格式与高级搜索兼容。因此filterToolbar参数将被发送到服务器。