Forum


15:33

03/11/2010

hi,
Thanks you very much for the great JqGrid !
I want the grid be already filtered when my page is loaded.
Then I want to use the triggerToolbar function but its don't work with new api.
So what is the substitue of that function in new api ?
or how to use the older api instead ?
Thanks you very much
16:31

10/08/2009

All functions inclusive triggerToolbar should works with new API. Do you try with
jQuery("#grid_id").jqGrid('filterToolbar',options);
where "grid_id" is the id of the table element of your grid? If this not work, then you should verify your JavaScript code or at least paste the code example in your question which can be used to reproduce your problem.
Best regards
Oleg
17:20

03/11/2010

Thansk for your answer.
I use this code :
<table id="idt-1"></table>
<div id="filter" style="margin-left:30%;display:none">filtre de recherche</div>
<script type="text/javascript">
var mygrid = jQuery("#idt-1").jqGrid({
url:"loaddata.php",
datatype: "json",
height:"auto",
colNames:[ "firstname","nickname","country"],
colModel:[ {name:"firstname",index:"firstname", width:75, sorttype:"text",classes:"cssfirstname",stype:"select", editoptions:{value:":All;John:John;Edward:Edward;Oliver:Oliver"}},
{name:"nickname",index:"nickname", width:75, sorttype:"text", align:"center",search:false}},
{name:"country",index:"country", width:110, sorttype:"text", align:"center",stype:"select", editoptions:{value:"USA:USA;:All;FRANCE:FRANCE;SPAIN:SPAIN"}},
],
mtype: "GET",
sortname: "nickname",
rowNum:500,
rowTotal: 500,
loadonce:true,
viewrecords: false,
rownumbers: true,
sortorder: "desc",
shrinkToFit:true,
gridview:true,
caption: "test"
});jQuery("#idt-1").jqGrid("filterToolbar");
var sgrid = $("#idt-1")[0];
sgrid.triggerToolbar();
</script>
Thanks you very much
Best regards
19:00

10/08/2009

You are right. There methods triggerToolbar, clearToolbar and toggleToolbar are really implemented in another way. It is documented by the way here. Do you have some conflicts? Why it is a problem to you the method triggerToolbar in the way like you as currently do?
By the way your code have a small error: one additional '}' after the declaration of the column "nickname". You should has
{name:"nickname",index:"nickname", width:75, sorttype:"text", align:"center",search:false},
instead of
{name:"nickname",index:"nickname", width:75, sorttype:"text", align:"center",search:false}},
Best regards
Oleg
18:04

03/11/2010

Hi, Thanks you very much for your answer.
In fact, I want to load my page with the filter USA:USA already activated.
I try both call to API :
1. jQuery("#idt-1″).jqGrid("filterToolbar"); and
2. jQuery("#idt-1").filterToolbar();
follow by
var sgrid = $("#idt-1″)[0];
sgrid.triggerToolbar();
In both case, my page is not filtered.
In the drop down select list, I have USA:USA by defaut but the data are not filtered on first print.
The most stange things is that when i use local data , the sgrid.triggerToolbar(); works and my page is filtered but when i use JSON, the methods don't work.
Thanks you by advance for your help.
10:32

03/11/2010

Hi,
this syntax :
I try both call to API :
1. jQuery("#idt-1″).jqGrid("filterToolbar"); and
2. jQuery("#idt-1″).filterToolbar();
follow by
var sgrid = $("#idt-1″)[0];
sgrid.triggerToolbar();
Both syntax don't work with Json.
How can I do to execute the filter after the page is loaded ?
Thanks you very much for your help
12:23

10/08/2009

Hello!
If you want to open to set and trigger the filter in the toolbar you can do the same as I described in the answer on the stackoverflow. Do the demo what you want?
Another old answer (see the demo from the answer), this and this about the role of postData for any kind of searching could be probably also helpfull for you.
Best regards
Oleg
18:27

03/11/2010

OlegK said:
Hello!
If you want to open to set and trigger the filter in the toolbar you can do the same as I described in the answer on the stackoverflow. Do the demo what you want?
...
Best regards
Oleg
Hi OlegK,
The first example is perfect for me and it's work fine.
THANKS YOU VERY MUCH FOR YOUR HELP.
JqGrid is a great tool.
Best regards,
Most Users Ever Online: 715
Currently Online:
51 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