Forum


11:37

11/01/2010

Hi, I was wondering if anyone was able to help me out with a small question regarding the advanced search functionality.
I am aware that (in PHP) the search variables for a standard search can be fetched with $_GET['_search'], $_GET['searchOper']...(etc)..however I cant for the life of me work out how to fetch the multiple criteria/terms passed with an advanced search. Is the data serialised and/or passed in an array (i.e. searchOper[0, 1, 2, etc...]). Also, as an aside, the '_search' variable always appears to be 'true', regardless of whether a search is being made or not, not sure if this is a bug/issue?
Many thanks for any help, much appreciated!
18:10

Moderators
30/10/2007

Hello,
The searchfilter set a filters tag to the server
http://www.trirand.com/jqgridw....._searching
Something like
$filters = $_REQUEST['filters']; //this a json string you will need to make it to array
$myserchs = json_decode($filters,true);
print_r($myserchs);
Enjoy
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
13:33

11/01/2010

Many thanks for your reply, however I am still having trouble with the script recognising any information at all sent by the search.
The Javascript I am using for my table is:
var lastsel;
$("#list").jqGrid({
url:'example.php',
datatype: 'xml',
hidegrid: false,
mtype: 'GET',
colNames:['field1','field2', 'field3','field4','field5'],
colModel :[
{name:'field1', index:'id', width:55, hidden:true, key:true, resizable:true},
{name:'field2', index:'ticker', width:75, resizable:true,editable:true, search:true},
{name:'field3', index:'name', width:200, align:'left', resizable:true,editable:true, search:true},
{name:'field4', index:'alias', width:200, align:'left', resizable:true,editable:true, search:true},
{name:'field5', index:'details', width:400, align:'left', sortable:false, resizable:true,editable:true, search:true}
],
pager: '#pager',
height:'100%',
rowNum:10,
rowList:[50,100,200],
sortname: 'ticker',
sortorder: 'asc',
viewrecords: true
});
$("#list").jqGrid(
'navGrid',"#pager",
{edit:true,add:true,del:true},
{}, // edit options
{}, // add options
{}, //del options
{multipleSearch:true} // search options
);
In example PHP I have the code:
$filters = json_decode($_REQUEST['filters'],true);
if($filters==""){
echo "arbitrary text to break the reposnse and give a blank table";
}
This should mean that when the table loads its blank as the data output is 'wrong' due to the text above appearing, but when search criteria is entered it is propogated as appropriate.
However, it seems regardless, $filters remains empty.
Any help hugely appreciated!
Most Users Ever Online: 715
Currently Online:
76 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66