Forum
20:35
01/09/2010
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]
00:02
10/08/2009
If you have JSON data as string you can use datatype: 'jsonstring' option and add the json data as datastr.
Regards
Oleg
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66