Forum
Topic RSS
Related Topics
19:44
27/08/2010
OfflineThe data gets returned successfully if i make a seperate $.ajax() call and assign to grid, but path included is displaying blank grid.
I have been struggling for a while :-
script :-
jQuery("#list1").jqGrid({
datatype: "json",
mtype: 'POST',
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
url: "SearchResults.asmx/Search",
colNames: ['From', 'To', 'Subject', 'Sent'],
colModel: [
{ name: 'from', index: 'from', align: 'left' },
{ name: 'to', index: 'to', align: 'left' },
{ name: 'subject', index: 'subject', align: 'left' },
{ name: 'sent', index: 'sent', align: 'left', sorttype: "date"}],
rowNum: 10,
rowList: [5, 10, 20, 50],
pager: '#pager3',
sortname: 'id',
viewrecords: true,
sortorder: "asc",
loadonce: true,
caption: 'Search Results',
imgpath: '../App_Themes/Orange/images',
loadError : function(xhr,status,error){
alert('error');
alert(status);
alert(error);
},
loadComplete: function (data) {
alert('loaded');
alert(data);
}
});
c# code
JQGridData gData = new JQGridData();
gData.total = "1";
gData.page = "1";
gData.records = results.LongLength.ToString();
gData.rows = new JQGridDataRow[results.LongLength];
for (int i = 0; i < results.LongLength; i++)
{
SearchResult sr = results[i] as SearchResult;
gData.rows[i] = new JQGridDataRow();
gData.rows[i].id = sr.From;
gData.rows[i].cell = new string[4];
gData.rows[i].cell[0] = sr.From;
gData.rows[i].cell[1] = sr.ToNames;
gData.rows[i].cell[2] = sr.Subject;
gData.rows[i].cell[3] = sr.Sent.ToShortDateString();
}
Can some help ?
20:17
10/08/2009
OfflineYou need include jsonReader like following
jsonReader: { root: "d.rows", page: "d.page", total: "d.total", records: "d.records" }
as a jqGrid parameter. Additionally
serializeGridData: function (postData) {
return JSON.stringify(postData);
}
is also needed where JSON.stringify is from json2.js which you can download from http://www.json.org/js.html could help you.
Best regards
Oleg
P.S. Parameter imgpath should be removed as depricated since jqGrid 3.5 (see /jqgridwiki/doku.php?id=wiki:upgrade_from_3.4.x_to_3.5)
20:49
27/08/2010
OfflineFirst and foremost thank you very much for the quick response. Now its working fine.
Except if I click on any of the row in the grid only first row is getting selected. Do i need to any changes for the script.
Actually i need to perform an ajax call when a row is selected. can you please help me.
Thanks
Saif
Most Users Ever Online: 994
Currently Online:
19 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
Log In
Home