Forum


05:21

28/08/2012

Hey guys,
I'm trying to fix someone else's code and I'm having difficulties getting the data into the grid. The grid loads perfectly without errors but the data never shows up.
First here's the json reponse from the server when I manually make the request just to check if it works:
{"status":"success","numRecords":"1","startRecord":1,"endRecord":"1","currentPage":1,"numPages":1,"headers":["Id","FamilyId","RegistrationKey","FirstName","MiddleName","LastName","HomeStreet","HomeCity","HomeState","HomePostalCode","HomeCountryRegion"],"feedback":[["13146","13146","11a48423a5b9c80c370940321eff2bbb","Dmitry","","Chayka","11 Testing","Toronto","CO","M1T 3P1","Canada"]]}
And this is the code which should implement the response from the server and populate the grid:
$("#jqgResultsList").jqGrid({
url: 'http://www.lacoptsdb.org/php/getsearchresults.php?' + <?php echo $urlparams; ?> + '',
datatype: 'json',
autowidth: true,
colNames: eval("([" + colnames + "])"),
colModel: eval("([" + colmodel + "])"),
pager: '#jqgResultsPager',
rowNum: 200,
rowList: [200,400,600,1000],
viewrecords: true,
height: 'auto',
multiselect: true,
caption: 'Search Results',
afterInsertRow : function(rowid, rowdata, rowelem) {
// Only show expander for those with family members
if(rowdata.HiddenFamilyCount == 0) {
$("#"+rowid+" td:eq(1)").empty().unbind("click");
}
},
gridComplete: function(){
var ids = $("#jqgResultsList").getDataIDs();
var rowData = $("#jqgResultsList").getRowData();
for(var i=0;i<ids.length;i++){
var col = $('#jqgResultsList').getCol('HiddenRegKey', false);
var regKey = col[i];
var cl = ids[i];
be = "<input style='margin-right:2px;' type='image' src='/images/icon-edit.png' title='Edit' value='Edit' onclick="editRow("+cl+",'"+regKey+"');" />";
bd = "<input type='image' src='/images/icon-trash.jpg' title='Delete' value='Delete' onclick="deleteRow("+cl+",'"+regKey+"');" />";
$("#jqgResultsList").setRowData(ids[i],{Actions:be+bd});
}
// Show the additional grid options when it is done loading
// Display Options | Export to Excel, etc...
$('#quickLinks').show();
}
})
.navGrid('#jqgResultsPager',{edit:false,add:false,del:false}) // Change to del:true when mass-delete is ready
.jqGrid('filterToolbar',{
stringResult: true,
searchOnEnter : false
})
;
}
I don't understand where the response is being held after the request in the "url:" attribute happens. How do I check if it passed or failed? Please help.
Thank you all in advance,
- ultimatum
Most Users Ever Online: 715
Currently Online:
44 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