Forum
08:42
22/03/2013
Hi,
I am trying to load json data in jqgrid but no data is being displayed. I have confirmed that the HRDatahandler.asp page returns json data. I am a jqgrid newbie and any help is appreciated.
Server side:
HRDataHandler code:
<%@ Language=VBScript %>
<% Response.AddHeader "Content-Type", "application/json"
QueryToJSON(dbconn,"SELECT TOP 500 Id,SkillName,SkillDescription,active,ISNULL(CompletionPlusYears,0) AS CompletionPlusYears,ISNULL(Reminder,'No') AS Reminder,ISNULL(ProjectID,0) AS ProjectID FROM dbo.HR_Skills").Flush Response.End
%>
Client side code:
$(function(){
$("#list").jqGrid({
url:'HR_Datahandler.asp',
datatype: "json",
colNames:['Id','SkillName', 'SkillDescription','active','CompletionPlusYears','Reminder','ProjectID'],
colModel:[
{name:'Id', index:'Id', width:55, key:true},
{name:'SkillName', index:'SkillName', width:150},
{name:'SkillDescription', index:'SkillDescription', width:200, align:'right'},
{name:'active', index:'active', width:80, align:'right'},
{name:'CompletionPlusYears', index:'CompletionPlusYears', width:150, sortable:false},
{name:'Reminder', index:'Reminder', width:80, align:'right'},
{name:'ProjectID', index:'ProjectID', width:80, align:'right'} ],
height:'auto',
pager: '#pager',
rowNum:10,
rowList:[25,50,100],
sortname: 'SkillName',
sortorder: "desc",
viewrecords: true,
gridview: true,
caption: "Skills Grid"
});
});
$("#list").jqGrid('navGrid','#pager',{edit:false,add:false,del:false});
<div id="pager" name="pager"></div>
<table id="list" name="list"><tr><td/></tr></table>
Thanks
08:55
10/08/2009
I am not sure which JSON data produce your code. I recommend you to read documantation about jsonReader especially about root and repeatitems properties of jsonReader. Thy to add jsonReader option in the following form:
If you will have no success you should include the exact response of server (the JSON data).
Best regards
Oleg
Most Users Ever Online: 715
Currently Online:
30 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