views:

645

answers:

2

I'm using jqGrid 3.5.2 and having issue with loading xml file from server side.

BTW I have found a similar post arround, but didn't help much though.

Here is my client Side code:

$(”#list4″).jqGrid({ url:'http://localhost/cgi-bin2/test.pl', datatype: 'xml',
         mtype: 'GET', height: 400, colNames:['No','Date'],
         colModel:[ {name:'call', index:'call', width:60, sorttype:'int'},
                    {name:'num',index:'num', width:90, sorttype:'int'}],
         multiselect: true,
         rowNum:10, rowList:[10,20,30], sortname: 'call',
         viewrecords:true, caption:'dummy'});

My Server Side response returns:

Content-Type: Content-type: text/xml;charset=utf-8 
   <?xml version='1.0' encoding = 'utf-8'?>
   <rows> <page>1</page> <total>1</total> <records>2</records>
   <row><cell>20</cell><cell>200</cell></row>
   <row><cell>30</cell><cell>300</cell></row> </rows>

The Client Side does properly receive the whole data thing through Ajax, but unfortunately doesnt add data to table display. Something wrong with the code ?

A: 
  • You cannot use fancy quotes for JavaScript strings or XML attributes.
  • There needs to be an extra line break after your last HTTP response header.
  • Put as space in-between the "xml" and "version" in xmlversion.
  • Make sure gridimgpath is defined.
Eli Grey
oops! rectified that but still doesnt load model.
ZeroCool
A: 

If the line

Content-Type: Content-type: text/xml;charset=utf-8

is pert of the text of the response buffer itself, then it should not be there. The response buffer has to be pure XML. See the documentation for examples

Ron Harlev