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
[ 3.8 - bug ] - Update table with a json string
30/09/2010
23:31
Avatar
jacquesh
Member
Members
Forum Posts: 4
Member Since:
30/09/2010
sp_UserOfflineSmall Offline

Hello, 

mystr =

"{" +

"total: '1'," +

"page: '1'," +

"records: '1'," +

"rows : [" +

"{id:'1', cell:['cell00711','cell12','cell13','cell12','cell13']}" +

"]" +

"}";

jQuery("#process_list")

.jqGrid("setGridParam", {datastr:mystr})

.trigger("reloadGrid");

The grid load data with no problem from an URL.

I've set datastr: mystr and datatype: 'jsonstring'. No JS error but the grid don't load new data.

I've the same problem with 3.7.

Any Idea ?

Thanks for your help.

01/10/2010
00:43
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello!

You used before wrong JSON data. Corresponds to http://www.json.org/ all strings must be double-quoited:

 

{
  "total": "1",
  "page": "1",
  "records": "1",
  "rows" : [
    {"id":"1", "cell":["cell00711","cell12","cell13","cell12","cell13"]}
  ]
}

So fix your code and it will work. I recommend you validate your JSON data in http://www.jsonlint.com/.

Regards
Oleg

01/10/2010
01:47
Avatar
jacquesh
Member
Members
Forum Posts: 4
Member Since:
30/09/2010
sp_UserOfflineSmall Offline

mystr = "{\"total\":\"1\",\"page\":\"1\",\"records\":\"1\",\"rows\" : [{\"id\":\"1\", \"cell\":[\"cell00711\",\"cell12\",\"cell13\",\"cell12\",\"cell13\"]}]}"

jQuery("#process_list")

.jqGrid("setGridParam", {datastr:mystr}) 

.trigger("reloadGrid");

same problem with a validated string.

Grid reload but with previous data.

another idea ?

01/10/2010
01:49
Avatar
jacquesh
Member
Members
Forum Posts: 4
Member Since:
30/09/2010
sp_UserOfflineSmall Offline

my jqGrid definition

$("#process_list").jqGrid({

datatype: 'jsonstring',

datastr: mystr,

colNames:['id','Pid','PPid', 'Name', 'Path','CmdLine'],

colModel:[

{name:'id', index:'id', width:0},

{name:'pid', index:'pid', width:50},

{name:'ppid', index:'ppid', width:50},

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

{name:'path', index:'path', width:250},

{name:'cmdline',index:'cmdline',width:300}

],

sortname: 'pid',

viewrecords: true,

sortorder: "desc",

multiselect: false,

caption:"Process list"

});

01/10/2010
09:07
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

In your case you have set 5 records, but your definition in colModel has 6 fields.

Pleadse read this carefully:

http://www.trirand.com/jqgridw.....#json_data

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

01/10/2010
11:46
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Moveover jacquesh you have to follow JavaScript syntax. If a string has " and you use ans " for the string definition you should escape there: ". Better to define mystr using single quote as:

var mystr = '{"total": "1","page": "1","records": "1","rows" : [{"id":"1", "cell":["cell00711","cell12","cell13","cell12","cell13"]}]}';

Regards
Oleg 

03/10/2010
01:42
Avatar
jacquesh
Member
Members
Forum Posts: 4
Member Since:
30/09/2010
sp_UserOfflineSmall Offline

OK, I've add a cell, change the form of jsonstring ; but the problem still the same.

var mystr = '{"total": "1","page": "1","records": "1","rows" : [{"id":"1", "cell":["cell00711","cell00711","cell12","cell13","cell12","cell13"]}]}';

jQuery("#process_list")

.jqGrid("setGridParam", {datastr:mystr})

.trigger("reloadGrid");

 Everything is OK via json(URL) but not with json(string)

Can you try to create a mini sample with a grid with new data when reloading with jsonstring as datatype.

I'd like to see a worked sample to be sure it's not a bug Embarassed

Thanks !

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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