Forum
When I setup my post data during a call-back to the beforeSearch event it does not send the newly appended search data:
My HTML:
<div id="ListPhoneTypeCallsPager" class="scroll" style="text-align:center;"></div>
My filterGrid (item = #ListPhoneTypeCalls:
$(item.replace('#', '#t_')).filterGrid(item, {
gridModel: true,
beforeSearch: function() {
$(item).appendPostData({ _search: true, Contact: $('#Contact').val() });
}
}
});
Actually I am not sure if this is the best way to dynamically change my postdata. What I want to ultimately do is to be able to change my search data because I use the grid to show a list of calls for an Account, and then also the same grid for a filtered list of calls for a particular Contact in that Account. So what I have done is I setup the postData to contain the extra Contact's id if I am on the contact screen. When on the server-side it sees the contact parm also, it simply filters it by the contact. This way I can define one grid and use it on two different screens, one for all calls on the account screen, and another for all calls for a specific contact on the contact screen. Unfortunately once I have set the postData with the contact's id in it (#Contact), it gets overridden during search and that is why I also wanted to set ut during the beforeSearch event. Not sure if this is the best way.
My Json object sent to the server when the grid loads:
Contact |
111 |
_search |
true |
accountId |
1 |
nd |
1248103740125 |
page |
1 |
phoneType |
true |
rows |
5 |
sidx |
CallDateUrl |
sord |
asc |
When I search via the gridToolbar it looks like this (note Contact is missing):
CallStatus |
3 |
_search |
true |
accountId |
1 |
nd |
1248103849270 |
page |
1 |
phoneType |
true |
rows |
5 |
sidx |
CallDateUrl |
06:40
Moderators
30/10/2007
Hello,
Not sure what you try to do. Also if I understand right?
1. You use filterGrid and send expra parameters appending them to posData (beforeSearch)
2. In the same way you use filterToolbar.
3. When you search with filter grid all is ok, but when you try to serch with filterToolbar the data appended from filterGrid does not appear when you perform search with it.
Is this the case?
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.
Yes Tony that seems to be the case. As long as I sort, page, etc, it works just fine, but as soon as I use the toolbar to enter a search value and hit the search icon or select a value from the toolbar's drop downs with auto search enabled, the append is not adding the value, my guess is the filtergrid event it is not firing at all. It also does not work when clicking the Reload icon and am not sure if it is supposed to. No Martin I never investigated it more, if it is a bug I am sure there is a way to code around it but wanted to get feedback from Tony first. Sorry for the delayed response I was on vacation.
Renso.
09:54
Moderators
30/10/2007
Hello,
Could you please try this way:
....
beforeSearch: function() {
$("#mygrid").setGridParam({postData:{ _search: true, Contact: $('#Contact').val() }});
}
}
Note the call of grid and the setGridParam. I feel that something is not good with $(item)...
Best 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.
Most Users Ever Online: 715
Currently Online:
71 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