Forum


10:43

04/11/2008

Hi,
I am trying to get a basic grid (like the example in the docs) to work under ASP.Net MVC.
Everything looks fine, the outline of the grid appears, the rollup button works, you can click on the column headers to sort, etc but the data is not appearing. I can see in firebug that the data is being requested and successfully returned but it doesn't appear in the grid and I get no errors.
I have tried using the standard XML format and also using a custom format and setting the XmlReader properties but the result is the same. Is there anything obvious that I should check? What is the best way to debug this?
I can post the grid options and Xml if it would help.
Many thanks in advance,
Phil
11:23

Moderators
30/10/2007

Hello,
Yes you can post here the configuration and the data returnrd from server
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.
11:55

04/11/2008

This was my second attempt (using custom XML). The grid is:
$(document).ready(function() {
$("#list").jqGrid({
url: '../Order.mvc/Xml',
mType: 'GET',
colNames: ['Num', 'First Name', 'Surname'],
colModel: [
{ name: 'num,', index: 'num', width: 55, resizable: true, xmlmap: "contactId" },
{ name: 'name', index: 'name', width: 90, resizable: true, xmlmap: "firstName" },
{ name: 'surname', index: 'surname', width: 120, resizable: true, xmlmap: "lastName" }
],
datatype: 'xml',
viewrecords: true,
pager: $('#pager'),
rowNum: 10,
rowList: [5, 10, 15],
sortname: 'num',
sortorder: 'desc',
multiselect: true,
multikey: "ctrlKey",
caption: 'My first grid',
imgpath: "/themes",
xmlreader: {
root: "contacts",
row: "contact",
page: "contacts>page",
total: "contacts>total",
records: "contacts>records",
repeatitems: false
}
});
});
and the XMl returned from the server is:
<?xml version="1.0" encoding="utf-8"?>
<contacts>
<page>1</page>
<total>1</total>
<records>2</records>
<contact>
<contactId>2</contactId>
<firstName>Barry</firstName>
<lastName>Gottshall</lastName>
</contact>
<contact>
<contactId>3</contactId>
<firstName>Armando</firstName>
<lastName>Valdes</lastName>
</contact>
</contacts>
Thanks.
12:01

04/11/2008

Let me try the XML again...
<?xml version="1.0" encoding="utf-8"?>
<contacts>
<page>1</page>
<total>1</total>
<records>2</records>
<contact>
<contactId>2</contactId>
<firstName>Barry</firstName>
<lastName>Gottshall</lastName>
</contact>
<contact>
<contactId>3</contactId>
<firstName>Armando</firstName>
<lastName>Valdes</lastName>
</contact>
</contacts>
01:49

Moderators
30/10/2007

Hello,
Java Script is case sensitive
you should not set
mType, but mtype
not
xmlreader but xmlReader
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.
03:56

04/11/2008

Thanks you both for your help and apologies for the very slow reply but I've been off work for nearly a week.
I have added an id field to the xmlReader so that it now looks like this:
xmlReader: {
root: "contacts",
row: "contact",
page: "contacts>page",
total: "contacts>total",
records: "contacts>records",
repeatitems: false,
id: "contactId"
}
I have changed the casing on mtype and xmlReader to be correct and I have checked the casing of all other attributes. Unfortunately the grid is still not loading any data.
Can you give me any hints as to where to look or how to go about debugging this issue?
Many thanks,
Phil
13:55

Moderators
30/10/2007

Hello,
I see all is correct. The only problem remains if you point to right
(existing) xml file. Also see in FireBug what you get
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.
03:47

04/11/2008

Hi,
Firstly thanks to everyone for your responses.
I have successfully got the grid to work by copying the XML into the javascript and using 'xmlstring'.
However when I copy the XML into a static file on my webserver and try to load the grid from that I still get the same issue, i.e. the grid is blank.
Firebug shows me the correct XMl in the response. The only possible issue here is that Firebug does not automatically have the response body saved. Instad I have to click the 'Load Response' button and Firebug will go and retrieve it. However this is also the case for other resources that downloaded as part of the page so I'm failry sure this isn't an issue.
Any more help would be gratefully received.
Thanks,
Phil
06:33

Moderators
30/10/2007

Thank's Yamil
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:
75 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