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
Strange Error in addRowData
30/09/2009
13:05
Avatar
SirPyros
Member
Members
Forum Posts: 3
Member Since:
30/09/2009
sp_UserOfflineSmall Offline

I  am getting a strange error when I attempt to call addRowData after an ajax call in the grid. It says rows.length is null or not an object and it occurs in this line

if (t.rows.length === 0)

I'll post how i'm calling the grid as well, perhaps someone could help me decipher this.

$("#myDiv").jqGrid({
        datatype: function(postdata) {           
            $.ajax({
                type: "POST",
                url: 'MYAJAXCALL',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data: JSON.stringify(postdata),
                complete: LoadComplete
            });
        },
        height: 450,
        colModel: [{ label: 'Field1', name: 'Field1', width: 100, resizable: false, sortable: true, align: 'center' },
                { label: 'Field2', name: 'Field2', width: 100, resizable: false, sortable: true, align: 'center' }],
        hidegrid: false,
        shrinkToFit: true,
        altRows: true,
        sortname: 'Fiedl1',
        sortorder: "asc",
        viewrecords: true,
        caption: 'My Grid',
        jsonReader: {
            root: "Data",
            page: "CurrentPage",
            total: "TotalPages",
            records: "TotalRecords",
            userdata: "UserData",
            repeatitems: false,
            id: "0"
        }, beforeSelectRow: function(id) {
            return false;
        },
        onHeaderClick: function(state) {
        },
        gridComplete: function() {          
        }
    });

function LoadComplete(jsondata, stat) {
    if (stat == "success") {
        var grid = $("#myDiv");
        var jData = JSON.parse(jsondata.responseText, null).d;
        if (jData.TotalRecords > 0) {
            var jsonData = [];
            $.each(jData.Data, function() {
                var rowData = { Field1: this.Field1, Field2: this.Field2};
                grid.addRowData(this.Field3, rowData)
            });
          
        } else {           
            grid.setGridHeight(25);
        }     
    } else {
        alert(jsondata.responseText);
    }
}

Thanks in advance for the help

02/10/2009
07:32
Avatar
SirPyros
Member
Members
Forum Posts: 3
Member Since:
30/09/2009
sp_UserOfflineSmall Offline

anyone have any thoughts on this?

02/10/2009
12:56
Avatar
SirPyros
Member
Members
Forum Posts: 3
Member Since:
30/09/2009
sp_UserOfflineSmall Offline

Nevermind solved it myself. I was trying to call jqgrid against a div instead of against a table.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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