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
Local Json Data
18/03/2011
19:42
Avatar
m4strmind
Member
Members
Forum Posts: 4
Member Since:
18/03/2011
sp_UserOfflineSmall Offline

I have defined a datagrid in the following way:

$("#grid").jqGrid(
        {
            height: 400,
            autowidth: true,
            datatype: 'local',
            altRows: true,
            colNames:
            [
                'col 1',
                'col 2',
                'col 3',
                'col 4',
                'col 5'
            ],
            colModel:
            [
                { name: 'col1', index: 'col1'},
                { name: 'col2', index: 'col2' },
                { name: 'col3', index: 'col3'},
                { name: 'col4', index: 'col4', formatter: cellFormatter},
                { name: 'col5', index: 'col5', formatter: cellFormatter }
            ],
            rowNum: gridData.rows.length,
            viewrecords: true,
            recordtext: "{2} Results",
            sortname: 'col1',
            sortorder: "ASC",
            caption: "caption",
            pager: '#pager',
            pgbuttons: false,
            pginput: false
        });
        $("#grid")[0].addJSONData(gridData);

the idea is that i want to send the data down from the server as gridData with the original request.

when the above code runs, it generates blank rows for each record, the ones with cell formatters will input undefined.

I do not want to use array data because i do not want generically assigned id'.  I need to minipulate the data base on outside criteria so i need non generic id's.

if i change the datatype to json, it does an ajax request for the data after the page loads which is unnecessary for this particular grid.

if i change the datatype to function(postData){}, it works and makes no request, however the sorting then no longer works.

21/03/2011
15:33
Avatar
m4strmind
Member
Members
Forum Posts: 4
Member Since:
18/03/2011
sp_UserOfflineSmall Offline

I was able to solve the issue by using local data but adding a column of name "id" to each row which gets used for the data.

this wasnt obvious from the documentation, but it seems to work!

Thanks anyway

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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