Forum


02:21

13/06/2009

Hi,
I'm using the Advanced Search feature (although this applies to simple search also) and have a few of questions that I'd apprecaite a bit of help with.
1. Is there any way - except changing within the locale js file - the caption you get on the Search pop-up (Search...)?. It seems to say in the wiki that it's set in the locale but I was wondering if there's another way to do it.
2. When the Search pop-up appears is there any way to set the default search field to, say, the third one listed. At the moment the drop-down lists the searchable fields in column order and defaults to the first one. The order I have my columns is logical for one reason or another but it would be handy to default the index of the dropdown list to something other than the first one listed.
3. I have a pager but can't work out how to remove the Search icon from it. I'm using a Toolbar with a bespoke icon so I'd prefer to only be able to access the Search pop-up with that - so as not to potentially confuse people. I'm sure this is simple and in the docs somewhere but I just can't find it - sorry.
4. This may be a bug - I'm not sure - but which I first load my grid I have a couple of pages (view records shows the record count) but the page forward/backward buttons don't work/not enabled. If I open the Search pop-up and just click reset and close the buttons become enabled and work as expected. Any ideas what I might be doing wrong?
Sorry this is such a shopping list but I thought it better to put them all into one post. Thanks for getting this far and any help/pointers will, as always, be greatly appreciated.
Mucho thanks in advance
Regards
Romyn
07:17

Moderators
30/10/2007

Hello,
1. http://www.trirand.com/jqgridw.....rch_config
caption can be set in the method.
2. in the search method options you can (I never try this, but it should work) :
$(”#mygrid”).searchGrid( {
onInitializeSearch : function (formid) {
$(”.fields select”,formid).val(”myname”);
// where myname is the index (or the name) from colModel
}
});
3. $(”#mygrid”).navGrid(”#pager”,{serarch:false});
http://www.trirand.com/jqgridw.....:navigator
4. Not sure. Check what is your server response if you load the grid for first time. Maybe there are missed things
Regards
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.
20:10

13/06/2009

Thanks Tony,
With 1 & 3 I was looking in the wrong place - fixed now - your fault for making jqGrid so comprehensive 😉
Your suggestion for 2 works a treat 🙂
As for number 4 ... what seems to be happening is when the grid initially loads the header sent to the url.php is asking for page=0 and the records say "-9 to 0" when returned - although the grid contains records 1-10. As soon as I do a sort or reset then next call is correct for page=1.
I can't see what I'm doing to cause this to happen. The only thing slightly different about the grid is that when I initially set it up I give it a dummy url which I then change using setGridParam and then use trigger("reloadGrid") to fill it.
This is the grid:-
$("#grid_rm_search").jqGrid({
url:'php/race_resultssearch.php?r=0',
datatype: "json",
autowidth: true,
height: 'auto',
shrinkToFit: false,
colNames:['racer_id','Pos','Bib#', 'Last Name', 'First Name', 'Sex', 'Age', 'Time'],
colModel:[
{name:'racer_id',index:'id', width:1, hidden:true, search:false},
{name:'place_overall', index:'place_overall',width:35, searchoptions:{sopt:['eq','le','ge']}},
{name:'racer_no',index:'racer_no', width:40, searchoptions:{sopt:['eq','cn']}},
{name:'last_name', index:'last_name',width:75, searchoptions:{sopt:['eq','bw','ew','cn']}},
{name:'first_name', index:'first_name',width:75, searchoptions:{sopt:['eq','bw','ew','cn']}},
{name:'sex', index:'sex',width:25, searchoptions:{sopt:['eq']}},
{name:'age', index:'age',width:25, searchoptions:{sopt:['eq','le','ge']}},
{name:'time_complete_dt', index:'time_complete_dt',width:50, search:false}
],
rowNum:10,
mtype: "POST",
pager: '#grid_rm_search_pager',
sortname: 'place_overall',
toolbar: [true,"top"],
viewrecords: true,
rownumbers: false,
pginput: false,
gridview : true,
sortorder: "asc"
}).navGrid('#grid_rm_search_pager',
{
edit:false,add:false,del:false,search:false,refresh:true
},
{}, // edit options
{}, // add options
{}, //del options
{
multipleSearch:true,
closeOnEscape:true,
} // search options
);
and this the reload (where curr_RaceID is an integer param set):
$("#grid_rm_search").setGridParam({
url:'php/race_resultssearch.php?r=' + curr_RaceID
}).trigger("reloadGrid");
Thanks again
Regards
Romyn
13:50

Moderators
30/10/2007

Hello,
I want to see the server response from the first cal, but yo can use the following trick
$(”#grid_rm_search”).jqGrid({
....
datatype:'local',
url: 'your url',
....
});
(”#grid_rm_search”).setGridParam({datatype:'json'}).trigger(”reloadGrid”);
Regards
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.
01:40

13/06/2009

Sorry - don't quite understand what you mean with that "trick".
The first call sends the Headers:-
_search false
nd ... (a long number)
page 0
rows 10
sidx place_overall
sord asc
Response begins with (up to start of 2nd record):-
{"page":"0","total":2,"records":"20","rows":[{"id":"19948","cell":["19948","1","8","Keflezighi","Meb"
,"M","34","02:09:14"]},{"id":.........
With that I get the funny records numbers.
After a sort the Headers and Response are the same except
Headers has:- page 1
Response has:- {"page":"1" ........
Not sure if that helps at all?
Romyn
04:21

Moderators
30/10/2007

Hello,
No problem, but did you see your first response – you have page:”0″ – this causes the problem.
Also correct your first server response to return page:”1″.
Pages start cont from 1 and not from 0
Regards
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.
23:32

Moderators
30/10/2007

Hello,
By default when the grid initialize we ask for page 1. You will need to check your code.
Also a better appoach is to check these server side and return the appropriate value from server.
Let me explain: If you ask for page:0 (posted from grid) - why your server return data?
In this case server should not return data.
Regards
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.
23:51

13/06/2009

That's a good question which unfortunately I don't know the answer.
I just copied one of the examples and changed the Select to point to my table structure. I don't know why it's doing what it's doing and I'll have to look into it and hopefully find a permanent solution.
In the meantime I've amended the PHP by adding near the beginning...
if ($page == 0) {
$page =1;
}
... and that seems to sort the problem out - although obviously the underlying cause is still there somewhere.
Thanks very much Tony for your time, and patience, I'm very grateful for it.
Kindest regards
Romyn
Most Users Ever Online: 715
Currently Online:
84 Guest(s)
Currently Browsing this Page:
1 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