Forum


12:45

19/03/2009

I can't get addJSONData to work. I'm doing something very simple which should work in theory. What's wrong with this piece of code?
<table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
$("#list")[0].addJSONData(JSON.parse("{total: 1, page: 1, records: 1, rows : [ {id: '1', cell:['1', '2007-10-01', 'test', 'note', 'new', '200.00', '10.00', '210.00']} ] }"));
Thanks,
Anthony
11:36

Moderators
30/10/2007

Hello,
Do not use JSON.parse - just send the string
Regards
Tony
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.
02:23

Moderators
30/10/2007

Hello,
Look at the examples - If I look right now you should do:
eval and not parse - i.e
$(”#list”)[0].addJSONData(eval("("+mystring+")"));
Regards
Tony
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.
12:42

19/03/2009

I've looked at the examples. It's still does not work. What I don't undestand is that yesterday you said:"Do not use JSON.parse - just send the string". Now you say "use eval and not parse". So, shall I just send the string or shall I use eval?
Have you actually tried the example on your machine? If so, can you post the working code?
Thanks.
03:34

Moderators
30/10/2007

Hello Anthony,
Sorry, but some time I do not have access to jqGrid code in order to answer exactly. Thanks for this - I will remember - when I'm not sure I will not answer.
Look at New in version 3.3 -> Data type as function
Here we have:
..jqGrid({
...
datatype : function (pdata) {
$.ajax({
url:'server.php?q=2',
data:pdata,
dataType:"json",
complete: function(jsondata,stat)
{ if(stat=="success") {
var thegrid = jQuery("#listdt")[0];
thegrid.addJSONData(eval("("+jsondata.responseText+")"))
}
}
});
},
...
});
Does this help?
Best Regards
Tony
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.
Most Users Ever Online: 715
Currently Online:
22 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66