Forum


23:15

23/12/2008

I have jqGrid implemented in my webpage and I am having an issue getting jqGrid to read the XML response from the server. Using firebug, I am sure that that correct message is getting sent and the response seems right... but the data isn't displayed. See Below :
Code :
echo "<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?>";
echo "<rows>";
echo "<page>".$pageNo."</page>";
echo "<total>".$lastPage."</total>";
echo "<records>".$CurCount."</records>";
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<row id='". $row['id']."'>";
echo "<cell>". $row['artist']."</cell>";
echo "<cell>". $row['album']."</cell>";
echo "<cell>". $row['quanity']."</cell>";
echo "<cell>". $row['price']."</cell>";
echo "<cell>". $row['place']."</cell>";
echo "<cell>". $row['link']."</cell>";
echo "</row>";
}
echo "</rows>";
?>
Response:
<?xml version="1.0" encoding="utf-8"?>
<rows><page>1</page><total>2</total><records>Array</records><row id='33'><cell>Driving Blind</cell><cell
>Driving Blind</cell><cell>2</cell><cell>0.77</cell><cell>Second Spin</cell><cell>http://www.secondspin
.com/cart.jsp?add=true&trans=buy&condition=used&type=1&price=0.77&id=885350</cell></row><row id='4'>
<cell>Bent Scepters</cell><cell>Blind Date with Destiny</cell><cell>7</cell><cell>1.47</cell><cell>Second
Spin</cell><cell>http://www.secondspin.com/cart.jsp?add=true&trans=buy&condition=used&type=1&price=1
.47&id=847459</cell></row><row id='28'><cell>Budapest</cell><cell>Too Blind to Hear</cell><cell>7</cell
><cell>1.59</cell><cell>Second Spin</cell><cell>http://www.secondspin.com/cart.jsp?add=true&trans=buy
&condition=used&type=1&price=1.59&id=2219316</cell></row><row id='2'><cell>Ben Harper/Blind Boys of Alabama
</cell><cell>Live at the Apollo</cell><cell>2</cell><cell>10.99</cell><cell>Second Spin</cell><cell>http
://www.secondspin.com/cart.jsp?add=true&trans=buy&condition=used&type=1&price=10.99&id=2525866</cell
></row><row id='10'><cell>Blind Guardian</cell><cell>Follow the Blind</cell><cell>1</cell><cell>12.99
</cell><cell>Second Spin</cell><cell>http://www.secondspin.com/cart.jsp?add=true&trans=buy&condition
=used&type=1&price=12.99&id=875330</cell></row><row id='18'><cell>Blind Melon</cell><cell>Best of Blind
Melon [Bonus DVD] [Limited Edition]</cell></row></rows>
And the jqGrid call :
$("#table1").jqGrid({
url:'wrap/query.php',
datatype: 'xml',
xmlReader : {
root: "rows",
row: "row",
page: "rows>page",
total: "rows>total",
records : "rows>records",
repeatitems: true,
cell: "cell",
id: "[id]",
},
mtype: 'GET',
colNames:['Artist','Album', 'Quan.','Price','Place','URL'],
colModel :[
{name:'artist', index:'artist', width:55},
{name:'album', index:'album', width:90},
{name:'quanity', index:'quanity', width:80},
{name:'price', index:'price', width:80},
{name:'place', index:'place', width:80},
{name:'link', index:'link', width:150}],
pager: jQuery('#pager'),
rowNum:50,
rowList:[10,20,30],
sortname: 'price',
sortorder: "asc",
viewrecords: true,
imgpath: 'js/themes/coffee/images',
caption: 'Your Search for: <? echo $mSearch; ?>'
Any Ideas?
13:28

24/12/2008

Most Users Ever Online: 715
Currently Online:
28 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