Forum


First of all, thank you to all the jquery & jqgrid Gods for making this possible. I am very new to jquery & jqgrid, but I am a truly new convert, it is taking me to the next level. Okay, enough with the …….
A little context, I am using webMethods 7.1 to call a dsp page which does all the work. It's pretty slick. I have a nice little query service that is the 'ur'l variable and it does a http response as expected.
Here's my question.
- I am not using the 'searching' stuff yet.
I do have a form, with 7 data entry fields, when the user pushes a 'button' the form is validated, the 'url' variable is created to pass my server side service the needed query parameters, and then runs the query, and the grid is popluated as expected…. When this happened, I fell in love.
When pressing the next-page, last-page, etc, the calls to the server are made and the correct results are returned….. so far so good, we are happy.
However, when I make a simple change to one of the form elements, and then press my button, I get to the form validation javascript, get to my javascript that builds a revised 'url' variable, but the query is not called…… so sad.
Here is my code:
//------------------------------------------------------------------------------------------------ Does heavy lifting, build DBGrid
function doQuery() {
if (validateInput()) {
jQuery(document).ready(function(){
//------------------------------------------------------------------------------------------------ Create full url
var thisURL = top.document.findMe.in_URL.value + '?q=';
thisURL = thisURL + '&in_uid=' + top.document.findMe.in_uid.value;
thisURL = thisURL + '&in_today=' + top.document.findMe.in_today.checked;
thisURL = thisURL + '&in_startDate=' + top.document.findMe.in_startDate.value;
thisURL = thisURL + '&in_endDate=' + top.document.findMe.in_endDate.value;
thisURL = thisURL + '&in_appcode=' + top.document.findMe.in_appcode.value;
thisURL = thisURL + '&in_pacuid=' + top.document.findMe.in_pacuid.value;
thisURL = thisURL + '&in_seruid=' + top.document.findMe.in_seruid.value;
alert('Testing: ' + thisURL);
//------------------------------------------------------------------------------------------------ jqGrid Stuff
jQuery('#mylist').jqGrid({
url:thisURL,
datatype: 'xml',
mtype: 'GET',
colNames:['Date','Time','UID','Application','Package','Service','Ref','Message'],
colModel :[
{name:'date' ,width:76 ,sortable:false},
{name:'time' ,width:78 ,sortable:false},
{name:'uid' ,width:132 ,sortable:false},
{name:'application' ,width:80 ,sortable:false},
{name:'package' ,width:110 ,sortable:false},
{name:'service' ,width:150 ,sortable:false},
{name:'cRef' ,width:35 ,sortable:false},
{name:'message' ,width:490 ,sortable:false}],
pager: jQuery('#pager'),
rowNum:25,
rowList:[25,50,75,100,250,500,1000],
viewrecords: true,
loadonce: false,
height:300,
imgpath: '../../YaleCore/themes/basic/images',
caption: 'Results'
});
});
} // endif
} // end function doQuery
I know that I am getting to the alert() and the proper url is being created. But, the url is not getting kicked offed. I have a debug statement in the service that it is doing the working and it doesn't get kicked off on the second time around pushing the 'button'
What am I missing? Any help would be welcomed.
Thanks in advanced.
Paul
12:11

Moderators
30/10/2007

Hello Paul,
The short answer.
When you click first time the button, the grid is created and the data is populated - this is ok, but when you click second time to the button the grid is already created and you can not create it again using your approach
There are some way to overcome this.
1. Before creating a grid you can apply GridUnload method to restore the element to its default state.
2. There are more elegant way
$("#mygrid").jqGrid({datatype:"local"....}).setGridParam({datatype:"xml"});
and when you click your button
$("#mybutton").click(function() {
thisURL= .....
$("#mygrid").setGridParam({url:thisURL}).trigger("reloadGrid");
});
Hope this helps
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:
52 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