New windows to open an Pdf File

Use this board to ask questions or have discussions with other Rich Displays users.
SDeanD
Profound User
Posts: 28
Joined: Thu Dec 12, 2013 11:34 pm
First Name: Dean
Last Name: ****
Company Name: RESD LLC
Phone: 812244-0647
Address 1: 1620 S 7th
City: Terre Haute
State / Province: Indiana
Zip / Postal Code: 47802
Country: United States
Contact:

Re: New windows to open an Pdf File

Post by SDeanD »

Correct. I setup Js alert windows to trap contents. I thought I could reference an element Id inside a row.... but could not. so I setup a new column and set width to 0 as first column of the grid and placed contents in it. the corrected code is as follows. the alert windows are commented out.

Code: Select all

function pdfclick(row) {
// alert(row) ;
  var fileid = getObj("Grid4").grid.getCellValue(row, 0);
//  alert(fileid);

  pui.download({ "id": fileid, "inline": true })
}
pdfclick(row);

just for my information, is there a "good" place to store JS script functions that is universal? not sure I like functions defined in the widget? maybe a script module?
thanks,
Dean
S Dean ****
CEO
R & E Software Design LLC.
IBM Business Partner since 1988
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: New windows to open an Pdf File

Post by Scott Klement »

For quick little one or two line scriptls, we generally recommend keeping them inside of the display file.

For more sophisticated things, you can store your code in the /www/your-instance/htdocs/profoundui/userdata/custom/js directory. If you are running a Profound Ui session (as opposed to Genie), it will automatically load any files in that directory that end in .js into your session. So you can create files there as needed to store your more sophisticated functions, and call them from your display files.
SDeanD
Profound User
Posts: 28
Joined: Thu Dec 12, 2013 11:34 pm
First Name: Dean
Last Name: ****
Company Name: RESD LLC
Phone: 812244-0647
Address 1: 1620 S 7th
City: Terre Haute
State / Province: Indiana
Zip / Postal Code: 47802
Country: United States
Contact:

Re: New windows to open an Pdf File

Post by SDeanD »

thanks. I finally figured that out with the js function alert.

I thought you could retrieve an element from a row. not just a column. I added a new column put my element in it and and set width to 0. all works now!


Code: Select all

function pdfclick(row) {
// alert(row) ;
  var fileid = getObj("Grid4").grid.getCellValue(row, 0);
//  alert(fileid);

  pui.download({ "id": fileid, "inline": true })
}
pdfclick(row);
thanks.
S Dean ****
CEO
R & E Software Design LLC.
IBM Business Partner since 1988
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: New windows to open an Pdf File

Post by Scott Klement »

You can use the get() function if you want to retrieve an element by id. Subfile fields will have a dot followed by the row number inserted. So you'd have PDFCLICK.1, PDFCLICK.2, etc. So if you wanted to retrieve it by field id, you could do

Code: Select all

var fileid = get("PDFCLICK." + row);
AjFromADS
New User
Posts: 11
Joined: Wed Sep 03, 2014 4:20 pm
First Name: Aj
Last Name: Flint
Company Name: Advanced Data Systems
Contact:

Re: New windows to open an Pdf File

Post by AjFromADS »

Scott, in the example EXIT program you gave, why is there an ENDIF right after the /FREE?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: New windows to open an Pdf File

Post by Scott Klement »

Hmmm.... I have no idea where that came from. Maybe it was a copy/paste mistake when I posted that code (a year or so ago)?

I will remove it from the post.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest