Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Getting Advanced Search variables in PHP
11/01/2010
11:37
Avatar
ergo_summary
Member
Members
Forum Posts: 3
Member Since:
11/01/2010
sp_UserOfflineSmall Offline

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!

13/01/2010
18:10
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

14/01/2010
13:33
Avatar
ergo_summary
Member
Members
Forum Posts: 3
Member Since:
11/01/2010
sp_UserOfflineSmall Offline

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!

14/01/2010
15:36
Avatar
ergo_summary
Member
Members
Forum Posts: 3
Member Since:
11/01/2010
sp_UserOfflineSmall Offline

Not to worry- I solved the issue utilising/referencing the excellent raft of demo files in the demo repository (search_adv.php specifically).

Many thanks indeed for your help- & what a great product!

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information