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
grid not loading data
03/06/2011
21:34
Avatar
dranney
Member
Members
Forum Posts: 8
Member Since:
02/03/2011
sp_UserOfflineSmall Offline

I can't seem to get the json data to load in the grid.  Here's my html

<html>
<head>
<title>AMAC Remedy</title>
<link type="text/css" href="static/styles/jquery.ui.all.css" rel="stylesheet">
<link type="text/css" href="static/styles/ui.jqgrid.css" rel="stylesheet">
<link type="text/css" href="static/styles/main.css" rel="stylesheet">
<script type="text/javascript" src="static/scripts/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="static/scripts/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="static/scripts/json2.js"></script>
</head>
<body>
<div id="af-logo"><img src="static/images/af-logo.png" /> <img src="static/images/afwa-logo.png" /></div>
<div id="header"><span class="title">AMAC Remedy</span><br /></div>
<div class="clear"></div>
<div id="contentMargin" > 
<div id="content" > 
<table id="jsonmap"></table>
<div id="pjmap"></div>
</div>
</div>
<div id="ajaxMessage"></div>
</body>
<script type="text/javascript">
$(document).ready( function () {
//     alert('got here 1');
     jQuery("#jsonmap").jqGrid({       
         url:'locations',
      datatype: "json",
         colNames:['Location Key','Location Name', 'Latitude', 'Longitude','Location Alias'],
         colModel:[
          {name:'locationKey',index:'locationKey', width:80},
          {name:'locationName',index:'locationName', width:150},
          {name:'latitude',index:'latitude', width:100},
          {name:'longitude',index:'longitude', width:100},
          {name:'locationAlias',index:'locationAlias', width:295, sortable:false}  
         ],
         rowNum:25,
//         rowList:[10,20,30],
         pager: '#pjmap',
         sortname: 'locationKey',
         viewrecords: true,
         sortorder: "asc",
      caption: "JSON Mapping",
   width: 1040,
      height: 600
    });
});
</script>
</html>

Here's the json string:

{total: 1, page: 1, records: 3, rows: [{locationKey:1,locationName:"Adelphi",latitude:39.03,longitude

:-76.96,locationAlias:""}, {locationKey:2,locationName:"Aiken",latitude:33.57,longitude:-81.73,locationAlias

:""}, {locationKey:3,locationName:"Al Asad Airfield",latitude:33.79,longitude:42.44,locationAlias:"Qadisiyah

Airbase, FOB Webster, Objective Weber, FOB Al Asad, Camp Al Asad, Navea Training Center"}]}

Does anyone have an idea as to what I am doing wrong?

04/06/2011
01:14
Avatar
Leandro Irgang
Brasil
Member
Members
Forum Posts: 21
Member Since:
04/01/2010
sp_UserOfflineSmall Offline

Hello

I think your problem is in json, it must be valid

you can validate your string in http://jsonlint.com/

Leandro Irgang

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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