Forum


09:58

06/10/2009

Hi all....
I have a problem...
I have a JQGRID inside UI.DIALOG, the Grid is filled with JSON from URL that have a dinamic value in it filled from an input.
The first time the JQGRID is called all is fine and I am getting my data, but the second time with a different value I am getting the data from previouce call (no refresh in the middle...)
Here is my JS
//alert('CustomerAddresses.php?customerNumber='+$("#CustomerNum").val());
//var table = document.getElementById("list22");
//for(var i = table.rows.length - 1; i > 0; i--)
//{
// table.deleteRow(i);
//}
gridimgpath = "../styles/images";
jQuery("#list22").jqGrid({
datatype: 'json',
url: 'CustomerAddresses.php?customerNumber='+$("#CustomerNum").val(), //call CustomerAddresses.php to fill the jQuery
mtype: 'GET',
height: 250, //table
fadeIn: 400,
cache: false,
rownumbers: true, //view row numbers
autowidth: true,
rowNum:10, //limit record in grid
rowList:[10,20,30,40,50],
//scroll: true,
//scrollrows: true,
shrinkToFit: true,
colNames:['Name','Address 1','Address 2', 'City', 'State','Zip','Country Code'],
colModel:[
{name:'C1NME',index:'C1NME', width:140},
{name:'C1AD1',index:'C1AD1', width:100},
{name:'C1AD2',index:'C1AD2', width:100},
{name:'C1CITY',index:'C1CITY', width:100},
{name:'C1STAT',index:'C1STAT', width:100},
{name:'C1ZIP',index:'C1ZIP', width:100},
{name:'C1CTR',index:'C1CTR', width:140,align:"right"}
],
pager: jQuery('#pager22'),
imgpath: gridimgpath,
multiselect: false,
onSelectRow: function(id) {
$("#shipToName").val($("#list22").getCell(id,"C1NME"));
$("#ShipToAddressLine1").val($("#list22").getCell(id,"C1AD1"));
$("#ShipToAddressLine2").val($("#list22").getCell(id,"C1AD2"));
$("#ShipToCity").val($("#list22").getCell(id,"C1CITY"));
$("#ShipToState").val($("#list22").getCell(id,"C1STAT"));
$("#ShipToZip").val($("#list22").getCell(id,"C1ZIP"));
$("#ShipToCountryCode").val($("#list22").getCell(id,"C1CTR"));
$('#modal2').dialog('close');
},
jsonReader : { root: 'rows', page: 'page', total: 'total' , records: 'records' }
});
$('#modal2').dialog('open');
}
on my PHP I have:
header ( 'Last-Modified: ' . gmdate ( 'D, d M Y H:i:s' ) . ' GMT' );
header ( 'Cache-Control: no-store, no-cache, must-revalidate' );
header ( 'Cache-Control: post-check=0, pre-check=0', false );
header ( 'Pragma: no-cache' );
so no caching here too...
Please help...
02:54

Moderators
30/10/2007

Hello,
You will need to call GridUnload method before constructing the grid. Something like:
function myfunction()
{
....
jQuery.("#list22").GridUnload();
jQuery.("#list22").jqGrid({...});
jQuery("#modal").dialog("open");
}
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:
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