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
Grid not displaying rows (ASP, jqgrid 3.6.5)
23/06/2010
18:44
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Hi,

I've worked with jqgrid a fair amount in php and thus I was hoping I could use it ASP.  Seems that's possible based on the docs but I can't seem to get it working.

Currently my webservice just returns a a sample peice of JSON text - based on the doc defs

Grid Def:

        jQuery("#list").jqGrid({
            //url: "WebService2.asmx/GetDistributionList",
            //data: "{'ID':'" + $('#ddReports :selected').val() + "'}",
            //datatype: 'json',
            //mtype: 'GET',
            //postData: { ReportID: $('#ddReports :selected').val() },
            datatype: function() {
                if ($('#ddReports :selected').val() != undefined) {
                    $(".loading").show();
                    //console.log(postdata);
                
                    jQuery.ajax({
                        url: 'WebService2.asmx/GetDistributionList',
                        data: JSON.stringify({ ReportID: $('#ddReports :selected').val() }),
                        //data: "{'ReportID':'" + $('#ddReports :selected').val() + "'}",
                        //data: JSON.stringify(postdata),
                        dataType: "json",
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        success: function(data) {
                            console.log('success function of ajax call');
                            var mygrid = $("#list")[0];
                            //console.log('data is ' + data);
                            //console.log('data.d is ' + data.d);
                            mygrid.addJSONData(data);
                        }
                    });
                }
            },
            loadComplete: function(data) {
                console.log('Grid Complete Function');
                $(".loading").hide();            
            },
            jsonReader: {
                root: "d.rows",
                page: "d.page",
                total: "d.total",
                records: "d.records",
                repeatitems: true,
                cell: "cell",
                id: "id",
                userdata: "userdata",
                subgrid: { root: "d.rows",
                    repeatitems: true,
                    cell: "cell"
                }
            },
            gridComplete: function() {
                $(".loading").hide();
            },
            colNames: ['A', 'B', 'C', 'D'],
            colModel: [
                { name: 'a', width: 300 },
                { name: 'b', width: 300 },
                { name: 'c', width: 200, align: 'right' },
                { name: 'd', width: 100, align: 'right' }
            ],
            pager: '#pager',
            rowNum: 100,
            rowList: [100, 200, 300],
            sortname: 'invid',
            sortorder: 'desc',
            viewrecords: true,
            width: 900,
            height: 400,
            caption: 'Distribution List'
        });

Doing a quick console.log of the data response I receive and object and the 'd' value is

success function of ajax call
data is [object Object]
data.d is { "total": "1", "page": "1", "records": "22","rows" : [{"id" :"1", "cell" :["cell11", "cell12", "cell13","cell14"]},{"id" :"2", "cell":["cell21", "cell22", "cell23","cell24"]}]}
However no data appears in my grid.  I see the loading dialog display and then disappear but the data itself never loads.
Any suggestions on how to get around this issue ? I've looked at a number of posts online and I can't seem to determine what the error is here.
Thanks in advance,
Nathan
25/06/2010
01:59
Avatar
michaelg
Member
Members
Forum Posts: 51
Member Since:
10/04/2010
sp_UserOfflineSmall Offline

Hi Nathan,

I think you need to change ...

mygrid.addJSONData(data)

... to ...

mygrid.addJSONData(data.d)

I hope that works!

Cheers,

Michael

25/06/2010
17:39
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Hi Michael,

Thanks for your reply.  I've tried data.d and I also see no results appearing in my grid.  I'm very puzzled at this point.

Do you, or anyone else, have any suggestions on what may be the problem.

I'd post an example but that's not possible as its merely running on my local host.

Nathan

29/06/2010
22:45
Avatar
Nathan
Member
Members
Forum Posts: 37
Member Since:
20/03/2009
sp_UserOfflineSmall Offline

Hi,

I still haven't resolved this issue.  Anyone have a suggestion on how to fix the issue? I've upgraded to 3.7.1 now and still I can't seem to load data.

Nathan

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
47 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