Forum
Topic RSS
21:49
02/02/2010
OfflineI am using dwr Ajax to return me a List<Map<String, String>> and I am trying to load the grid.
This is how I define my grid:
jQuery('#terminalGroups').jqGrid({
datatype: 'clientSide',
colNames: ['Company','Name','Active'],
colModel: [
{name:'company', index:'company', width:500},
{name:'TG_NAME', index:'TG_NAME', width:300},
{name:'activeGroup', index:'activeGroup', width:195} ],
pager: jQuery('#terminalGroupPager'),
rowNum: 10,
rowList: [10,20,30],
sortorder: 'desc',
viewrecords: true,
imgpath: 'jquery/jqueryUI/css/sunny/images',
caption: 'Merchant Groups',
height: '490px'
});
Now, I get a structure back from Ajax call, and I want to add it using following command:
however, I get the JS error that "object does not support this property or method". However, if I iterate through "result" and use
it works just fine...
What am I doing wrong on addJSONData???
18:14
03/02/2010
OfflineHi. Read the jqGrid documentation, everything is explained there! addJSONData is a special method:
var mygrid = jQuery(”#”+grid_id)[0];
var myjsongrid = eval(”(”+jsonresponse.responseText+”)”);
mygrid.addJSONData(myjsongrid);
myjsongrid = null;
jsonresponse =null;
will populate the data to the grid. And, of course, the data in myjsongrid can be manipulated before being passed to addJSONData.
See http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods
22:48
02/02/2010
OfflineThank you for reply, but I have read that already... The problem is it does not specify much about data array (what should it look like). Here is example data what I use:
This looks like a proper JS array to me...
12:03
03/02/2010
Offline18:06
02/02/2010
OfflineThank you for that information… However, i am still facing the problem. This is my code:
jQuery('#terminalGroups').jqGrid({
datatype: 'json',
colNames: ['Company','Name','Active'],
colModel: [
{name:'company', index:'company', width:500},
{name:'TG_NAME', index:'TG_NAME', width:300},
{name:'activeGroup', index:'activeGroup', width:195} ],
pager: jQuery('#terminalGroupPager'),
rowNum: 10,
rowList: [10,20,30],
sortorder: 'desc',
viewrecords: true,
imgpath: 'jquery/jqueryUI/css/sunny/images',
caption: 'Merchant Groups',
height: '490px'
});
var something = { "data":[{'company':'1','TG_NAME':'1','activeGroup':'1'},{'company':'2','TG_NAME':'2','activeGroup':'2'}], "totalRows":2, "totalPages":1, "page":1 };
jQuery('#terminalGroups')[0].addJSONData( something );
However, I get JS syntax error, and when I debug, it points to this code:
any idea what might that be?
15:26
Moderators
30/10/2007
OfflineHello,
You should configure your jsonReader. Please read here how this can be achieved
http://www.trirand.com/jqgridw.....#json_data
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 994
Currently Online:
29 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
Log In
Home