Forum
18:04
16/09/2011
I'm doing a proof of concept for my work and I'm bumping into issues. My base grid looks like this.
url : <link>,
datatype : 'json',
colNames : ['Date', 'Vendor', 'Item #', 'Pack', 'Description', 'History' ],
colModel : [
{ name : 'date', index : 'date', width: 75, sortType: 'date', datefmt: 'mm/dd/yyyy'},
{ name : 'vndr', index : 'vndr', width: 300},
{ name : 'item', index : 'item', width: 60, align : 'left' },
{ name : 'pack', index : 'pack', width: 40, align : 'right', search: false },
{ name : 'desc', index : 'desc', width: 300, align : 'left' },
{ name : 'hist', index : 'hist', width: 50 } ],
rowNum : 25,
height: 'auto',
width: 1036,
altRows: true,
sortable: true,
pager : '#pager', sortname : 'date', sortorder : 'desc', viewrecords : true,
jsonReader : { root : 'root', page : 'currentPage', total : 'totalPages', records : 'totalCount', repeatitems : false },
caption : 'Text'
When I go to export via this code
$('<table id>').jqGridExport({exptype:'jsonstring'});
I seem to get every config option available including the defaults instead of just the stuff I've manually defined. According to the /jqgridwiki/doku.php?id=wiki:import_methods
Like I said, I could just roll my own export but that seems like a lot of overhead. I might just be doing this wrong but searching google for 2-3 days hasn't netted me any working examples on line other than some asp.net stuff which I can't run(java). So, I was just curious if I was doing this wrong or if this was maybe a bug that hadn't been found because import/export isn't that often used.
Any help would be greatly appreciated.
23:57
16/09/2011
To follow up, I managed to get it working slightly by posting this into my controller instead of the export.
'{"grid": ' + JSON.stringify($('#grid').jqGrid("getGridParam")) + '}';
However, this appears to break subgrids. I get a second subgrid column header and other stuff. That being said, it makes me believe the issue is that the export is posting in something that's not invalid. I tried a bunch of things to get this working so I might mistake something here but I believe I tried xml instead and it included \\n characters. So, it's highly likely that it's not stripping the data correctly for whatever reason. What I was doing was posting it into a spring controller as a string using jackson to marshall. So, it's possible that some where there its encoding got screwed up too. I didn't want to have to build an object to map it to since I was never going to be altering that data on the back end. Also, I noticed when I had a subgrid it wasn't posting in a valid json. The function javascript wasn't playing nice with things.
Either way, I feel like this area of the documentation could use a lot of love. A working example would be great.
Most Users Ever Online: 715
Currently Online:
40 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