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
can't get updateGridRows to work - help
02/03/2012
08:18
Avatar
ptmoy
New Member
Members
Forum Posts: 2
Member Since:
02/03/2012
sp_UserOfflineSmall Offline

I'm just leaning to use jqgrid, and have finally got some json data to load correctly using the following html file:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My First Grid</title>
 
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid/css/redmond/jquery-ui-1.8.18.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid/css/ui.jqgrid.css" />
 
<style type="text/css">
html, body {
    margin: 0;
    padding: 0;
    font-size: 75%;
}
</style>
<script src="jqgrid/js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="jqgrid/js/jquery.jqGrid.src.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
  $("#list").jqGrid({
    url:'http://192.168.37.25:8000/jqgr.....&#039;,
    datatype: 'json',
    mtype: 'GET',
    colNames:['Col1','Col2', 'Col3','Col4','Col5','Col6'],
    colModel :[
      {name:'c1', index:'c1', width:75},
      {name:'c2', index:'c2', width:75},
      {name:'c3', index:'c3', width:75},
      {name:'c4', index:'c4', width:75},
      {name:'c5', index:'c5', width:75},
      {name:'c6', index:'c6', width:75}
    ],
    pager: '#pager',
    rowNum:20,
    rowList:[10,20,30],
    sortname: 'c1',
    sortorder: 'desc',
    viewrecords: true,
    gridview: true,
    caption: 'Positions'
  });
});

var retval = $('#list').jqGrid ('updateGridRows', [{c2:"test2", c3:"test3"}], "x2");
if (retval == true)
  alert ("true returned");
else
  alert ("false returned");

</script>
 
</head>
<body>
<table id="list"><tr><td/></tr></table>
<div id="pager"></div>
</body>
</html>

JSON data returned by my server looks like this:

{
  "total": "1",
  "page": "1",
  "records": "5",
  "rows": [
      {"id": "x1", "cell": ["(1,1)", "(1,2)", "(1,3)", "(1,4)", "(1,5)", "(1,6)"]},
      {"id": "x2", "cell": ["(2,1)", "(2,2)", "(2,3)", "(2,4)", "(2,5)", "(2,6)"]},
      {"id": "x3", "cell": ["(3,1)", "(3,2)", "(3,3)", "(3,4)", "(3,5)", "(3,6)"]},
      {"id": "x4", "cell": ["(4,1)", "(4,2)", "(4,3)", "(4,4)", "(4,5)", "(4,6)"]},
      {"id": "x5", "cell": ["(5,1)", "(5,2)", "(5,3)", "(5,4)", "(5,5)", "(5,6)"]}
  ]
}


As mentioned, the data loads correctly into the grid. But the updateGridRows call doesn't work for some reason. Data on the grid doesn't change.
When I trace the code using firebug, I found out jqgrid is throwing an error ("jqGrid - No such method: updateGridRows") here:

$.fn.jqGrid = function( pin ) {

if (typeof pin == 'string') {

//var fn = $.fn.jqGrid[pin];

var fn = $.jgrid.getAccessor($.fn.jqGrid,pin);

if (!fn) {

throw ("jqGrid - No such method: " + pin);

}


When I download jqgrid, I checked all boxes (including the "custom" box) as instructed in the Wiki. What am I doing wrong?

BTW, I also tried using setRowData to modify a row also; that didn't work either. Also, I tried puting the updateGridRows call inside

a loadComplete event handler - same result. Please help.

02/03/2012
08:23
Avatar
ptmoy
New Member
Members
Forum Posts: 2
Member Since:
02/03/2012
sp_UserOfflineSmall Offline
I'm re-posting the last part of my previous post because it got cut off.


As mentioned, the data loads correctly into the grid. But the updateGridRows call doesn't

work for some reason. Data on the grid doesn't change. When I traced the code using firebug,

I noticed jqgrid is throwing an error ("jqGrid - No such method: updateGridRows") here:

 $.fn.jqGrid = function( pin ) { if (typeof pin == 'string') { //var fn = $.fn.jqGrid[pin]; var fn = $.jgrid.getAccessor($.fn.jqGrid,pin); if (!fn) { throw ("jqGrid - No such method: " + pin); } When I downloaded jqgrid, I checked all boxes (including the "custom" box) as instructed in the Wiki.

What am I doing wrong?

BTW, I also tried using setRowData to modify a row; that didn't work either.

Also, I tried puting the updateGridRowscall inside a loadComplete event handler - same result. Please help.
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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