Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






JQGrid cannot load JSON data from struts 2 action

UserPost

18:43
26/06/2012


zigzak

New Member

posts 2

Hi everyone,

I have a problem when loading data to jqgrid from struts 2 actionConfused

My action return JSON data:

{"page":"1","records":"31",
"rows":["{'id':'1','cell':['1','Cant open destop','Destop','Easy','duongls','huyld','minhnq','Finance ','Open']}",
"{'id':'2','cell':['2','Cant log to email','Email','Normal','thangtd','minhnq','longnh','Secretary ','Assigned']}",
"{'id':'3','cell':['3','No internet access Edited ver 2 longnh','Connection','Hard','thangtd','longnh','longnh','Secretary ','Closed']}",
"{'id':'4','cell':['4','Request password','Account','Normal','dungtq','honglm','longnh','Director','Cancelled']}",
"{'id':'5','cell':['5','Cant open latop','Laptop','Hard','duongls','huyld','minhnq','Director','Closed']}",
"{'id':'6','cell':['6','issue 11111111111111','','','dungtq','longnh','','Planning','Open']}",
"{'id':'7','cell':['7','Issue ku minh heo','','','dungtq','longnh','','Planning','Open']}",
"{'id':'8','cell':['8','New ticket 12345','','','dungtq','longnh','','Planning','Open']}",
"{'id':'9','cell':['9','Mail server cannot connect','','','haitct','longnh','','Director','Open']}",
"{'id':'10','cell':['10','aaaaaaaaaaaa','','','dungtq','longnh','','Planning','Open']}"],"total":"4"}

JSP:
$("#list1").jqGrid({                  
                    url: "<%=request.getContextPath()%>/pagingIssue?time="+new Date().getTime(),
                    colNames:['Id','Name', 'Type','Severity', 'Owner','Register', 'Responsor', 'Department','Status'],
                    colModel:[
                              {name:'issId',index:'issId', width:40, sortable:true},
                              {name:'issName',index:'issName', width:200, sortable:true},
                              {name:'issType',index:'issType', width:100, sortable:true},
                              {name:'issSeverity',index:'issSeverity', width:100, sortable:true},
                              {name:'issOwner',index:'issOwner', width:80, sortable:true},
                              {name:'issRegister',index:'issRegister', width:100, sortable:true},
                              {name:'issResponsor',index:'issResponsor', width:100, sortable:true},
                              {name:'department',index:'department', width:120, sortable:true},
                              {name:'issStatus',index:'issStatus', width:80, sortable:true}],
                    rowNum:10,
                    rowList:[10,15,20],
                    pager: '#pager1',
                    sortname: 'issId',
                    datatype: 'json',
                    recordpos: 'left',
                    viewrecords: true,
                    sortorder: 'desc',
                    multiselect: true,
                    caption: 'Issue List' });
                });

The table just show Loading.... forever
Can anyone help meFrown

18:48
26/06/2012


zigzak

New Member

posts 2

Here are the image of grid

error

error

16:47
04/07/2012


jogep

Germany

Member

posts 23

I guess the problem is your jqGrid instance does not know where it can find the records in your result.

$("#list1").jqGrid({                  
    url: "<%=request.getContextPath()%>/pagingIssue?time="+new Date().getTime(),
    jsonReader: { root: "rows" },
    // more config
});

My Blog: http://www.jgeppert.com @Twitter: http://twitter.com/jogep


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

48 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9591

Posts: 28784

Membership:

There are 10168 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7009 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information