Note that there are some explanatory texts on larger screens.

plurals
  1. POJson Data not loading in jqGrid with spring 3 mvc
    text
    copied!<p>On click of a button I am trying to load the jqgrid with json datadtype. I tried many ways to load data but it gets fails and displays empty grid. Please advise wht I am missing here.</p> <p>My Grid</p> <pre><code>$("#bedata").click(function(){ jQuery("#list2").jqGrid({ url:'/mso/interop/interopcompanycfg/getDSAccounts?companyId=${interopcompcfg.company.id}', datatype: "json", mtype: 'GET', colNames:['Id','DTCCID','COMPANYID','DTCCACCOUNTID'], colModel:[ {name:'ID',index:'id', sortable:true, align:'center',width:90}, {name:'DTCCID',index:'dsId', sortable:true, align:'center',width:90}, {name:'COMPANYID',index:'companyId',sortable:true, align:'center', width:120}, {name:'DTCCACCOUNTID',index:'dsLegalEntityId', sortable:true, align:'center',width:130} ], rowNum:10, rowList:[10,20,30], pager: '#pager2', sortname: 'dsId', viewrecords: true, sortorder: "desc", caption:"DS ACCOUNTS", jsonReader: { repeatitems : false, root:"rows", cell: "", id: "0" } }); jQuery("#list2").jqGrid('navGrid','#pager2',{edit:true,add:true,del:true}); }); spring requestmapping @RequestMapping(value="/getDSAccounts",method= RequestMethod.GET) public @ResponseBody List&lt;Vector&lt;String&gt;&gt; getDSAccountsJSON(HttpServletRequest request,HttpServletResponse httpResponse) { try{ UsersJsonDTO usersJsonDTO = new UsersJsonDTO(); usersJsonDTO.setPage("1"); usersJsonDTO.setRecords("8"); usersJsonDTO.setTotal("20"); Company cmp=(Company) request.getSession().getAttribute("company"); List&lt;DSAccounts&gt; message = interopService.getDSAccounts(cmp); httpResponse.setContentType("text/javascript"); int i=0; List&lt;DTCCAccounts&gt; rowJsonList = new ArrayList&lt;DTCCAccounts&gt;(); for (DSAccounts dsAccountDTO:message) { DTCCAccounts rowJson = new DTCCAccounts(); rowJson.setId(String.valueOf(i+1)); rowJson.setDsId(String.valueOf(dsAccountDTO.getDsId())); rowJson.setCompanyId(String.valueOf(dsAccountDTO.getCompany().getId())); rowJson.setDsLegalEntityId(dsAccountDTO.getDsLegalEntityId()); rowJsonList.add(rowJson); } usersJsonDTO.setRows(rowJsonList); return usersJsonDTO; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload