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
Trouble with JSON
30/01/2010
23:10
Avatar
dorr
Member
Members
Forum Posts: 15
Member Since:
24/01/2010
sp_UserOfflineSmall Offline

I'm trying to get the basic grid working using JSON but it's not displaying the data.  Can anyone tell me what I'm doing wrong?  Here is my html and json:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<link rel="stylesheet" type="text/css" media="screen" href="C:/jqgrid_test/jquery_theme/css/ui-lightness/jquery-ui-1.7.2.custom.css" />

<link rel="stylesheet" type="text/css" media="screen" href="C:/jqgrid_test/jqgrid/css/ui.jqgrid.css" />

<link rel="stylesheet" type="text/css" media="screen" href="C:/jqgrid_test/jqgrid/src/css/ui.multiselect.css" />

<script src="C:/jqgrid_test/jqgrid/js/jquery-1.3.2.min.js" type="text/javascript"></script>

<script src="C:/jqgrid_test/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>

<script src="C:/jqgrid_test/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script>

jQuery(document).ready(function(){

jQuery("#stateList").jqGrid({

url:'state.json',

datatype:"json",

jsonReader : { root: "rows",

page: "page",

total: "total",

records: "records",

repeatitems: true,

cell: "cell",

id: "id",

subgrid: { root:"rows", repeatitems: true, cell:"cell" }

},

colNames:["State Id","State Code","State Name"],

colModel :[

{name:"stateId", index:"stateId", width:70},

{name:"stateCde", index:"stateCde", width:100},

{name:"stateNameTxt", index:"stateNameTxt", width:200}

],

pager: jQuery("#pager"),

sortname: "stateNameTxt",

sortable: true,

sortorder: "desc",

rowNum:10,

rowList:[10,20,30],

viewrecords: true,

caption: "State List",

multiselect:true,

loadtext:"Loading...",

loadonce: true

});

});

</script>

</head>

<body>

<table id='stateList'></table>

<div id='pager' style='text-align:center;'></div>

</body>

</html>

{

total: '1',

page: '1',

records: '4',

rows : [

{id:'1', cell:['1', 'GL', 'Georgia']},

{id:'2', cell:['2', 'SC', 'South Carolina']},

{id:'3', cell:['3', 'NC', 'North Carolina']},

{id:'4', cell:['4'", 'FL', 'Florida']}]}

31/01/2010
19:22
Avatar
dorr
Member
Members
Forum Posts: 15
Member Since:
24/01/2010
sp_UserOfflineSmall Offline

Got it working, had an extra quote in the file

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
38 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