Forum


12:02

04/09/2008

Hi,
I'm using Lotus Domino's inbuilt functionality to render a view of data in JSON (in the domino world: nameofview?openview&outputformat=json).
The generated JSON looks like this (I have no control over the format that is generated):
{
"@toplevelentries": "65",
"viewentry": [
{
"@position": "1",
"@unid": "033087497B8C279B882574B8007D1F25",
"@noteid": "9CA",
"@siblings": "65",
"entrydata": [
{
"@columnnumber": "0",
"@name": "AssignedTo",
"text": {
"0": "Don Green"
}
},
{
"@columnnumber": "1",
"@name": "$73",
"text": {
"0": "033087497B8C279B882574B8007D1F25"
}
},
{
"@columnnumber": "2",
"@name": "ITOwner",
"text": {
"0": "George Thomas"
}
},
{
"@columnnumber": "3",
"@name": "Form",
"text": {
"0": "Ticket"
}
},
{
"@columnnumber": "4",
"@name": "TitleShort",
"text": {
"0": "Add a new hard drive to PC"
}
}
]
},
{
"@position": "2",
"@unid": "0AB9D255471131B0882574B8007D1F06",
"@noteid": "94E",
"@siblings": "65",
"entrydata": [
{
"@columnnumber": "0",
"@name": "AssignedTo",
"text": {
"0": "Bela Lugosi"
}
},
{
"@columnnumber": "1",
"@name": "$73",
"text": {
"0": "0AB9D255471131B0882574B8007D1F06"
}...
I'm new to JSON and jquery, and was wondering if anyone could show me the correct jsonreader and colmodel for the above json? Is it possible to use the json as generated above?
My attempt looks like this:
jQuery("#list").jqGrid({
height:'300px;',
url:'myview?readviewentries&outputformat=json&count=-1',
datatype: 'json',
mtype: 'GET',
jsonReader : {
root: "viewentry",
rows: "@position",
page: "page",
records: "@toplevelentries",
repeatitems: false,
cell: "entrydata",
id: "@position",
},
colNames:['UNID', 'AssignedTo', 'ShortTitle'],
colModel :[
{name:'UNID', index:'UNID', jsonmap: 'text[0]', width:200, key:true},
{name:'AssignedTo', index:'AssignedTo', width:200},
{name:'ShortTitle', index:'ShortTitle', width:200},
],
pager: jQuery('#pager'),
rowNum:10, rowList:[10,20,30],
sortname: 'id',
sortorder: "desc",
viewrecords: true,
imgpath: 'themes/basic/images',
caption: 'Service Requests'
});
What I can see in firebug is that I am getting the json correctly, and the grid draws on the page with the columns, but they are all empty (no data). This is because my jsonreader isn't correct?
Thanks
GW
07:01

Moderators
30/10/2007

Hello,
I will try to check this
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.
01:53

21/11/2008

Hi,
Even i am trying to use jsonmap to map a cell value to a arbitrary json structure and am having issues populating the grid with TS1, TS2 values below. Any help will be appreciated.
"rows":[{"cell1":{"v":"TS1"},"cell2":{"v":"A01"}},
{"cell1":{"v":"TS2"},"cell2":{"v":"A02"}}]
I tried to define the following in coModel, but it doesnt like the cell1.v
{name:'cell1.v',index:'cell1.v', jsonmap:'cell1.v', width:55, key:true}
/SK
04:24

Moderators
30/10/2007

Hello,
You do not need to define
{name:'cell1.v',index:'cell1.v', jsonmap:'cell1.v', width:55, key:true}
if you have jsonmap.
try this instead
{name:'cell1',index:'cell1.v', jsonmap:'cell1.v', width:55, key:true}
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.
13:47

21/11/2008

Thanks tony.
I tried
{name:'cell1',index:'cell1.v', jsonmap:'cell1.v', width:55, key:true}
It still complains about the cell1.v
Is anything required under json reader. It currently reads as follows
jsonReader : {
root: "rows",
page: "currpage",
total: "totalpages",
records: "totalrecords",
repeatitems: false,
cell: "rows"
}
/SK
16:07

21/11/2008

Also, going with the same approach using an xml as below
<rows>
<cell1 v="TS1"/><cell2 v="A01"/>
</rows>
<rows>
<cell1 v="TS2"/><cell2 v="A01"/>
</rows>
is the following the correct format under colmodel using xmlReader
{name:'cell1',index:'cell1.attr("v")', xmlmap:'cell1.attr("v")', width:55, key:true},
/SK
00:40

Moderators
30/10/2007

Hello,
Hello,
The attribute in XML can be used only for the id - to work this
<row>
<cell1> TS1 </cell1>
<cell2> TS2 </cell2>
</row>
{name:'cell1',index:'cell1',xmlmap:'cell1'...}
xmlReader : {
repeatitems : false,
row : "row"
root : "here_is _your_root",
...
}
Also refere to jsonReader in the docs on what you can do with it
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.
21:19

21/11/2008

Thanks tony.
I did a second pass in the translation to move the attribute values to elements. Good job at the grid plugin...its pretty cool.
I had a couple of issues with the css not showing the buttons and had to change the default table css definition.
Also, if i make the cells editable for the grid, and there exists a sub grid, double clicking it shows the raw html with the underlying table definition. Is there a property to avoid this ?
Thanks,
SK
01:53

Moderators
30/10/2007

Hello,
Will check this. Maybe it is not connected with the css.
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: 715
Currently Online:
56 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