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
Rows not being displayed for local or json data
20/04/2010
06:39
Avatar
sdebaun
Member
Members
Forum Posts: 3
Member Since:
20/04/2010
sp_UserOfflineSmall Offline

I've been beating my head against this all day; I'm hoping this is something stupid that everyone knows about except for me. 🙂

I'm using jquery 1.4.2, jquery-ui 1.8, jqgrid 3.5.3.

I can't get rows to show up in the grid at all.  The grid itself displays, with the appropriate column headings.  I get the same result in Chrome and in Firefox.  Initially, I was using json to get the rows.  In my attempts to isolate the problem I've finally ended up using the code straight from the example at:

/blog/jqgrid/jqgrid.html

Under Loading Data: Array Data.

This is driving me nuts.  Does anyone have any suggestions?  The only thing I can think of now is some sort of incompatibility with the versions of jquery, jquery-ui, and jqgrid.

<html>

<head>

<link href="./Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />

<script src="./Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>

<script src="./Scripts/jquery-ui-1.8.custom.min.js" type="text/javascript"></script>

<script src="./Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>

<script type="text/javascript">

$(document).ready( function() {

jQuery("#list4").jqGrid({

datatype: "local",

height: 250,

colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],

colModel:[

{name:'id',index:'id', width:60, sorttype:"int"},

{name:'invdate',index:'invdate', width:90, sorttype:"date"},

{name:'name',index:'name', width:100},

{name:'amount',index:'amount', width:80, align:"right",sorttype:"float"},

{name:'tax',index:'tax', width:80, align:"right",sorttype:"float"},

{name:'total',index:'total', width:80,align:"right",sorttype:"float"},

{name:'note',index:'note', width:150, sortable:false}

],

multiselect: true,

caption: "Manipulating Array Data"

});

var mydata = [

{id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},

{id:"2",invdate:"2007-10-02",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},

{id:"3",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},

{id:"4",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},

{id:"5",invdate:"2007-10-05",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},

{id:"6",invdate:"2007-09-06",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"},

{id:"7",invdate:"2007-10-04",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},

{id:"8",invdate:"2007-10-03",name:"test2",note:"note2",amount:"300.00",tax:"20.00",total:"320.00"},

{id:"9",invdate:"2007-09-01",name:"test3",note:"note3",amount:"400.00",tax:"30.00",total:"430.00"}

];

for(var i=0;i<=mydata.length;i++)

jQuery("#list4").jqGrid('addRowData',i+1,mydata[i]);

});

</script>

</head>

<body>

<table id="list4"></table>

</body>

</html>

20/04/2010
18:24
Avatar
sdebaun
Member
Members
Forum Posts: 3
Member Since:
20/04/2010
sp_UserOfflineSmall Offline

Bump?

This has to be something stupid, like library version incompatibility.  I'll try switching around what versions I'm using and see if that helps.

UPDATE:

Switched library versions, to no avail.

For shits and giggles, I switched this call:

$("#list4″).jqGrid('addRowData',i+1,mydata[i]);

to this call:

("#list4″).addRowData(i+1,mydata[i]);

and it worked.  Wtf.

Now off to wrestle with the json version and see why its not working. 🙂

20/04/2010
20:08
Avatar
sdebaun
Member
Members
Forum Posts: 3
Member Since:
20/04/2010
sp_UserOfflineSmall Offline

Whiskey Tango Foxtrot.

Apparently this:
{
"total": "2",
"page": "1",
"records": "2",
"rows": [
{
"id": "1",
"cell": ["Michael Smith", "Wanker"]
},
{
"id": "2",
"cell": ["Raymond Shaw", "Also Wanker"]
}
]
}

Is not equivalent to this:
{
total: "2",
page: "1",
records: "2",
rows: [
{
id: "1",
cell: ["Michael Smith", "Wanker"]
},
{
id: "2",
cell: ["Raymond Shaw", "Also Wanker"]
}
]
}

While the JS that defines the grid doesn't require quotes around key names in hashes, the JSON data returned from the server does...?

Well, it's working now. I'm going to go find a baby to punch to relieve my frustration.

24/04/2010
21:09
Avatar
DadOnRed
Member
Members
Forum Posts: 3
Member Since:
24/04/2010
sp_UserOfflineSmall Offline

Would you mind reposting your current / working code for local array data? I've got a similar problem (not working at all, trying to get through the basic demo code on the site). Appreciate any help here!

Here is what I currently have:

<head>

<link rel="stylesheet" type="text/css" media="screen" href="./jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="./ui.jqgrid.css" />
<script src="./grid.locale-en.js" type="text/javascript"></script>
<script src="./jquery.jqGrid.min.js" type="text/javascript"></script>
 <script type="text/javascript">   
 jQuery(document).ready(function(){
    jQuery("#list4").jqGrid({
            datatype: "local",
            height: 250,
            colNames:['Backup No','Date', 'Size', 'Direction','Elapsed Time','Completed?','Notes'],
            colModel:[
                    {name:'id',index:'id', width:60, sorttype:"int"},
                    {name:'bkupdate',index:'bkupdate', width:90, sorttype:"date"},
                    {name:'size',index:'size', width:60},
                    {name:'direction',index:'direction', width:150, align:"left",sorttype:"float"},
                    {name:'dur',index:'dur', width:80, align:"right",sorttype:"float"},
                    {name:'succ',index:'succ', width:30,align:"right",sorttype:"float"},
                    {name:'note',index:'note', width:150, sortable:false}
             ],
             pager: jQuery('#pager'),
             rowNum:10,
             viewrecords: true,
             multiselect: true,
             caption: "Offsite Data Transfer Log Summary"
     });
      var mydata = [
                          {id:"1",bkupdate:"2010-04-30",size:"12GB",direction:"LAN to DC1",dur:"450",succ:"Y",note:"note"},
                          {id:"2",bkupdate:"2010-04-29",size:"12GB",direction:"LAN to DC1",dur:"430",succ:"Y",note:"note2"},
                        {id:"3",bkupdate:"2010-04-28",size:"11GB",direction:"LAN to DC1",dur:"420",succ:"Y",note:"note3"},
                        {id:"4",bkupdate:"2010-04-27",size:"11GB",direction:"LAN to DC2",dur:"425",succ:"Y",note:"note"},
                        {id:"5",bkupdate:"2010-04-26",size:"10GB",direction:"LAN to DC1",dur:"410",succ:"Y",note:"note2"},
                        {id:"6",bkupdate:"2010-04-25",size:"10GB",direction:"LAN to DC1",dur:"400",succ:"Y",note:"note3"},
                        {id:"7",bkupdate:"2010-04-24",size:"9GB",direction:"LAN to DC1",dur:"390",succ:"Y",note:"note"},
                        {id:"8",bkupdate:"2010-04-23",name:"9GB",direction:"LAN to DC1",dur:"380",succ:"Y",note:"note2"},
                        {id:"9",bkupdate:"2010-04-22",name:"8GB",direction:"LAN to DC1",dur:"375",succ:"Y",note:"note3"}
                   ];
      for(var i=0;i<=mydata.length;i++)
                  jQuery("#list4").addRowData(i+1,mydata[i]);
  });
 </script>
</head>

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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