Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
jqgrid not displaying rows
06/05/2014
20:54
Avatar
mithilwane
India
New Member
Members
Forum Posts: 1
Member Since:
06/05/2014
sp_UserOfflineSmall Offline

JQGrid version – 4.6 JQuery Version – 1.10

The Rows are shown in HTML. But jqgrid doesnot show the rows. Have even tried adding row one by one instead. But didnt help. I am new to JQgrid. I am just trying these things in my code based on the examples on the internet. I am totally unable to understand what is going wrong here.

This is my jquery code

$("#tblStateTableData").jqGrid({ datatype: 'local', width: 800, //specify width; optional colNames:['State Code','State Name', 'Active Y/N'], //define column names colModel:[ {name:'id', index:'id', key: true, width:100, hidden:false}, {name:'stateNm', index:'stateNm', width:150, hidden:false}, {name:'activeYn', index:'activeYn', width:100, edittype:"checkbox", hidden:false} ], //define column models pager: '#pager', //set your pager div id rowNum:10, sortname: 'id', //the column according to which data is to be sorted; //optional viewrecords: true, //if true, displays the total number of records, etc. //as: "View X to Y out of Z” optional sortorder: "asc", //sort order; optional }); function getCountryCode() { var countryCd = $('#txtCountry').val(); $("#txtCountryCd").val(countryCd); if (countryCd != "") { $.post("getStateTableList.html",{ "countryCd" : countryCd },function(data) { data = $.parseJSON(data); if (data.status == "success") { var stateTableList = data.stateTableList; $('#tblStateTableData').jqGrid('setGridParam', {datatype:"jsonstring" ,datastr:stateTableList}).trigger('reloadGrid'); } }); } }

The JSON Returned from Java Code is as follows

"{"page":"1","records":7,"rows":[{"cell":["MELBOURNE","Y"],"id":1},{"cell":["NEW SOUTH WALES","Y"],"id":7},{"cell":["QUEENSLAND","Y"],"id":6},{"cell":["SOUTH AUSTRALIA","Y"],"id":3},{"cell":["TASMANIA","Y"],"id":5},{"cell": ["VICTORIA","Y"],"id":4},{"cell":["WESTERN AUSTRALIA","Y"],"id":2}],"total":"1"}"

And here is Java Code

JqgridModel grid = new JqgridModel(); grid.setPage("1"); grid.setRecords(stateListObj.size()); grid.setTotal("1"); List rows = new ArrayList<>(); for (EppsStateMst eppsStateMst : stateListObj) { JQGridRow row = new JQGridRow(); row.setId(eppsStateMst.getId().getStateCd()); List cells = new ArrayList(); cells.add(eppsStateMst.getStateNm()); cells.add(eppsStateMst.getActiveYn()); row.setCell(cells); rows.add(row); } grid.setRows(rows); JSONSerializer serializer = new JSONSerializer(); String jsonResult = serializer.exclude("*.class").deepSerialize(grid); json.addProperty("status", "success"); json.addProperty("stateTableList", jsonResult); return json.toString();
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
36 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information