Forum

July 12th, 2025
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
Blank Grid
10/08/2009
04:59
Avatar
centrium
Member
Members
Forum Posts: 3
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi Guys

I really hope someone can point me out please?

I am trying to bind a json response from a ASP.Net2 Webservice however I am having very little success, I have the following code, which I have seen from another forum post that the guy managed to get to work. What it is doing is going out to the webservice to get a response, on success use the addJSONData to add it to the grid. However what is happening is that I am getting a $.jqGrid.stripHTML error and nothing is being bound to the grid.

The JSON response I am getting from the webservice is

{"d":{"__type":"jqGridData","total":"1","page":"1","records":"1","rows":[{"id":"1","cell":["45","5","140"]},{"id":"2","cell":["45","5","140"]},{"id":"3","cell":["45","5","140"]}]}}

When I run this through an online parse it looks fine, the only thing I feel it could be is that jqGrid does not
know what to do with the __type field. Is this a correct assumption? The rest of the response
seems to match what the specification says.

I have tried to manually use this with jsonstring and jsonstr params, but I get a $.jqgrid.parse error then.

I feel all the pieces are in place, but something isnt quite correct, I'm not interested in paging the data, so just want
something to display my data.

Any help would be appreciated.




$("#history").jqGrid({
        datatype: function(){$.ajax({
                       url: "EmissionsDataHandler.asmx/LoadUserTest",
                       data: JSON.stringify({username:"Test"}),
                       dataType: "json",
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        complete: function(jsondata, stat) {
                            if (stat == "success") {
                data = JSON.parse(jsondata.responseText).d
                $("#history")[0].addJSONData(data)
                            }
                        }
                    });
        }
        ,
        colNames:['ID', 'Annual Leave', 'Known Emissions','Commuting Days'],
        colModel:[{name:'Id',index:'Id',width:250},
                {name:'AnnualLeave',index:'AnnualLeave',width:250},
                {name:'KnownEmissions',index:'KnownEmissions',width:100},
                {name:'CommutingDays',index:'CommutingDays',width:100},
                    ],
        rowNum: 10,
        viewrecords: true,
        caption: "Commuting History",
        width:  600,
        height: 200,
    });

10/08/2009
06:11
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Correct first these errors and try:

colModel:[{name:'Id',index:'Id',width:250},
                {name:'AnnualLeave',index:'AnnualLeave',width:250},
                {name:'KnownEmissions',index:'KnownEmissions',width:100},
                {name:'CommutingDays',index:'CommutingDays',width:100}, <----- Error

              ]

You shoulds not have this here:

.....

        rowNum: 10,
        viewrecords: true,
        caption: “Commuting History”,
        width:  600,
        height: 200, <---------- This too
    });

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.

10/08/2009
07:54
Avatar
centrium
Member
Members
Forum Posts: 3
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi Tony

Thanks for the suggestion, not sure how I missed these but I did. Embarassed

I have cleared these up but it is still complaining about a $.jgrid.StripHTML error. Cry

10/08/2009
08:16
Avatar
centrium
Member
Members
Forum Posts: 3
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Update:

I finally managed to get the grid to render, I didnt realise the order that the jsgrid.js and locale.js files needed to be put in a specific order, therefore by putting locale infront of jsgrid it appears to be working.

Tony, thanks again for pointing those commas out to me, they obviously were going to be a problem 🙂

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
21 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.com

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information