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
Help needed with addJSONData method
13/09/2010
20:35
Avatar
simspace
Member
Members
Forum Posts: 12
Member Since:
01/09/2010
sp_UserOfflineSmall Offline

Hi,

Due to design reasons I must use the addJSONData method to load my grid.

Can anyone please tell me why my call the addJSONData method does not work?

Below the code is an image of my results.

Thanks!

Chris

$j(document).ready(function() {
    /*————————————————*/
    
    $j("#leadlist").jqGrid({
        datatype: 'json',
        altRows:true,
        loadonce: true,
        colNames:['counselor_id','first_name','last_name','email_address','phone','comment'],
        colModel :[
            {name:'counselor_id', index:'counselor_id', key:true, formatter:'integer', sorttype:'int', width:55},
            {name:'first_name', index:'first_name', width:150},
            {name:'last_name', index:'last_name', width:150, sortable:false},
            {name:'email_address', index:'email_address', width:150, sortable:false},
            {name:'phone', index:'phone', width:150, sortable:false},
            {name:'comment', index:'comment', width:150, sortable:false}
        ],
        jsonReader : {
            root: function (obj) { debugger; return obj; },
            cell: function (obj) { return obj; },
            page: function (obj) { return 1; },
            total: function (obj) { return 1; },
            records: function (obj) { return obj.length; }
        },
        ondblClickRow: function(rowid, rowndx, colndx, objEvent)
        {
            top.location.href = '/counselor-hub/lead-profile/id/'+rowid;
        },
        width:750,
        height:400,
        pager: '#leadpager',
        rowNum:30,
        rowList:[15,30,60,100],
        sortname: 'name',
        sortorder: 'desc',
        viewrecords: true,
        caption: 'Counselor Leads'
    });

$j('#leadlist')[0].addJSONData('[{"counselor_id":40,"first_name":"Rick","last_name":"tester","email_address":"rick@tester.org","phone":"555-666-7777","comment":"My test comments"}]');

})

[Image Can Not Be Found]

14/09/2010
00:02
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

If you have JSON data as string you can use datatype: 'jsonstring' option and add the json data as datastr.

Regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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