Forum
13:51
20/01/2012
Hi all,
this is not the first time I see some java to json serializer having this beahviour with List of object:
if there is more than one entry i've a javascript array associated with a variable, but if the list has only one element then the variable holds directly the object (could be a json, could be a string, ....).
this is the output of a 2 elements list
{"page":"1","records":"2","rows":[{"cod_cliente":"-",...},{"cod_cliente":"-",...}],"total":"1"}
and this if 1
{"page":"1","records":"1","rows":{"cod_cliente":"-",...},"total":"1"}
rows.... to be or not to be an array...
also if is not a jqGrid's problem it doesnt'work!
i simply suggest this little patch to be more solid
in the addJSONData function just after the line
if (!drows) { drows = []; }
add
if (ts.p.records == 1) {
if (! drows.length) {
var no_array_row = drows;
drows = new Array(1);
drows[0] = no_array_row;
}
}
Most Users Ever Online: 715
Currently Online:
24 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