grid display using program - grid does not show

Started by Jon Toomsen, February 01, 2024, 07:49:51 PM

Previous topic - Next topic

Jon Toomsen

<!DOCTYPE html>
<html>
<head>
</head>
<body>
[ttl]Grid[/ttl]<br>
[grid MyGrid program="myprog.pxp;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=2]
[/grid]
</body>
</html>



! myprog.pxp
MAKEGRID:
OPEN (HFN,IOL=GRIDIOL)"*memory*"
LET MYGRID=LFO
SELECT * FROM INTERNETITEM
WRITE (MYGRID)
NEXT RECORD
EXIT
GRIDIOL:IOLIST ITEMCODE$,ITEMNAME$,ITEMTYPE$
!



Devon Austen

Hi Jon,

When debugging a Webster issue the first step is to hover over the red highlighted section on the page. The tool tip will give you error information which will help you figure out your issue.

I believe your issue is that your page does not have a [form] and the grid needs to be in a [form].

You also need to add

ENTER MYGRID

right under the MAKEGRID: line

This is how the grid program can pass back the handle to the grid memory file.

So try this:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
[ttl]Grid[/ttl]<br>
[form]
[grid MyGrid program="myprog.pxp;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=2]
[/grid]
[/form]
</body>
</html>



! myprog.pxp
MAKEGRID:
ENTER MYGRID
OPEN (HFN,IOL=GRIDIOL)"*memory*"
LET MYGRID=LFO
SELECT * FROM INTERNETITEM
WRITE (MYGRID)
NEXT RECORD
EXIT
GRIDIOL:IOLIST ITEMCODE$,ITEMNAME$,ITEMTYPE$

Normally you would have a program= in the [form] to specify the program to run when form is submitted and that would handle any events on the page.

For information on the use of the form see here:
https://manual.pvxplus.com?Webster/Webster%20Application%20Design.htm

For the need for the ENTER you can see the program= short code documentation here: https://manual.pvxplus.com?Webster/Short%20Code%20Options.htm

It looks like we need to update the example on the Using Grids in Webster+ documentation page to include the ENTER statement as that is missing.
Principal Software Engineer for PVX Plus Technologies LTD.

Jon Toomsen

[form] was needed now a shell of the grid is shown.

Now I have internetitem not found in dictionary.
have tried both ways - program= and the execute statement

I have an application library under the prog folder.
The query for internetitem works.

.

Devon Austen

Is the channel number for a open file in the variable INTERNETITEM of is the name of the file INTERNETITEM. If that is the name of the file you are just missing quotes in the select statement

i.e.

SELECT * FROM "INTERNETITEM"
Principal Software Engineer for PVX Plus Technologies LTD.

Jon Toomsen

added quotes - it is not a channel no ( was a typo earlier )

Jon Toomsen

Get the shell of the grid - column titles but the grid is not populated.
Nothing in red is displayed

Devon Austen

Does the file INTERNETITEM have records in it?

Does the fields defined for INTERNETITEM match the IOL used in your program?
Principal Software Engineer for PVX Plus Technologies LTD.

Mike King

I tried the following with no problem:

HTML file demo.html (placed in the pages directory):

<!DOCTYPE html>
<html>
<head>
</head>
<body>
[ttl]Grid[/ttl]<br>
[form]
[grid MyGrid program="myprog;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=5]
[/grid]
[/form]
</body>
</html>


Program file "myprog" (in the prog directory)

! myprog (placed in the prog directory)
MAKEGRID:
  enter MYGRID
  open (hfn,iol=GRIDIOL)"*memory*"
  MYGRID=lfo
  while 1
  read data iol=gridiol,end=*break
  write (MYGRID)
  wend
!
  exit
!
  data "item1","First Item","A"
  data "item2","Second Item","B"
  data "item3","Third Item","A"
  data "item4","Last Item","C"
!
GRIDIOL:  iolist ITEMCODE$,ITEMNAME$,ITEMTYPE$


Rather than read from a file I used in-code DATA values to make sure there was data present.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jon Toomsen

this is what I get using html and prog - see attached
</span><br /><span>   </span><br /><span>   </span><br /><span>
</span><br /><span>   </span><br /><span>   </span><br /><span>
</span><br /><span>   </span><br /><span>   </span><br /><span>
</span><br /><span>   </span><br /><span>   </span><br /><span>

Jon Toomsen

html and program
[ttl]Grid[/ttl]
[form]
[grid MyGrid program="myprog;makegrid" size=auto/20 ]
[col Source=ItemCode$ ttl="ItemCode" width=30 ]
[col Source=ItemName$ ttl="Name" width=50]
[col Source=ItemType$ ttl="Type" width=5]
[/grid]
[/form]

! myprog (placed in the prog directory)
MAKEGRID:
  enter MYGRID
  open (hfn,iol=GRIDIOL)"*memory*"
  let MYGRID=lfo
  while 1
  read data iol=GRIDIOL,end=*break
  write (MYGRID)
  wend
!
  exit
!
  data "item1","First Item","A"
  data "item2","Second Item","B"
  data "item3","Third Item","A"
  data "item4","Last Item","C"
!
GRIDIOL:
  iolist ITEMCODE$,ITEMNAME$,ITEMTYPE$
!