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
jsonreader can it read this? (Lotus Domino created JSON)
05/09/2008
12:02
Avatar
FujiGW
Member
Members
Forum Posts: 3
Member Since:
04/09/2008
sp_UserOfflineSmall Offline

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

06/09/2008
07:01
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

09/09/2008
13:48
Avatar
FujiGW
Member
Members
Forum Posts: 3
Member Since:
04/09/2008
sp_UserOfflineSmall Offline

thanks Tony...

29/09/2008
17:52
Avatar
simmi
New Member
Members
Forum Posts: 1
Member Since:
30/09/2008
sp_UserOfflineSmall Offline

Hi there,

were you able to figure out whats wrong with the jsonreader?

thanks

Simmi

02/10/2008
17:15
Avatar
FujiGW
Member
Members
Forum Posts: 3
Member Since:
04/09/2008
sp_UserOfflineSmall Offline

Hi Simmi...

No I was not able to figure this out. I got put on a diff project for the last couple of weeks. I will probably take a look at this again over the next week and report if I get any success.

21/11/2008
01:53
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

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

21/11/2008
04:24
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

21/11/2008
13:47
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

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

21/11/2008
16:07
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

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

24/11/2008
00:40
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

25/11/2008
21:19
Avatar
skkarri
Member
Members
Forum Posts: 12
Member Since:
21/11/2008
sp_UserOfflineSmall Offline

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

26/11/2008
01:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information