Page 2 of 2
Re: New windows to open an Pdf File
Posted: Tue Jan 21, 2014 10:56 am
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
Re: New windows to open an Pdf File
Posted: Tue Jan 21, 2014 11:00 am
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.
Re: New windows to open an Pdf File
Posted: Tue Jan 21, 2014 1:54 pm
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.
Re: New windows to open an Pdf File
Posted: Tue Jan 21, 2014 2:52 pm
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);
Re: New windows to open an Pdf File
Posted: Mon Oct 27, 2014 4:58 pm
by AjFromADS
Scott, in the example EXIT program you gave, why is there an ENDIF right after the /FREE?
Re: New windows to open an Pdf File
Posted: Mon Oct 27, 2014 11:21 pm
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.