Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Can't get data to appear in grid
04/11/2008
10:43
Avatar
philruelle
Member
Members
Forum Posts: 10
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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

04/11/2008
11:02
Avatar
nsorochan
Member
Members
Forum Posts: 17
Member Since:
29/08/2008
sp_UserOfflineSmall Offline

I think seeing your code would be helpful.

04/11/2008
11:23
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

04/11/2008
11:55
Avatar
philruelle
Member
Members
Forum Posts: 10
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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.
04/11/2008
12:01
Avatar
philruelle
Member
Members
Forum Posts: 10
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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>

04/11/2008
16:36
Avatar
nsorochan
Member
Members
Forum Posts: 17
Member Since:
29/08/2008
sp_UserOfflineSmall Offline

Do you need an id field in your xml data?

06/11/2008
01:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

11/11/2008
03:56
Avatar
philruelle
Member
Members
Forum Posts: 10
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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

11/11/2008
07:57
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Hi. Maybe you would need to add the xmlmap in your colModel...

11/11/2008
08:45
Avatar
philruelle
Member
Members
Forum Posts: 10
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

Thanks, but the colModel already specifies this - unfortunately there is a problem with word wrap so this part has gone off the edge of the post although you can see it via 'View Source'!

11/11/2008
09:07
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Test using an xml string in your code. See "Xml String" in the docs...

11/11/2008
13:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

12/11/2008
03:47
Avatar
philruelle
Member
Members
Forum Posts: 10
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

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

12/11/2008
07:49
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Phil, I think it could be the response header..

Set to text/plain or text/xml...

12/11/2008
08:40
Avatar
philruelle
Member
Members
Forum Posts: 10
Member Since:
04/11/2008
sp_UserOfflineSmall Offline

Fantastic. It works! The MVC framework defaults to text/html which was what was cuasing it to fail.

Thank you all so much for your help.

13/11/2008
06:33
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information