If I have a simple table that stores a PDF in the database, and I'm showing those lines on a grid...
normally you drill down to the Form, then click the attachment Widget and the attachment is shown in a popup.
I'd like to popup a window directly from the grid (to save a step) - lets say from a row operation button (or I could get fancy and trap a click on a grid column)
If it was an image, and it was in the filesystem, I could popup a window with an html cell using <img> and show the image like that.
How can I show the PDF directly from the grid?
Without having to bring up a form and clicking in the widget:
[SOLVED] how can i view a PDF Attachment directly from the Grid?
[SOLVED] how can i view a PDF Attachment directly from the Grid?
Last edited by Jaymer on Thu Dec 02, 2021 8:55 pm, edited 1 time in total.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 620
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: how can i view a PDF Attachment directly from the Grid?
AwareApp.viewDocument might do what you are looking for.
To test it out, you could use an operation button that executes JavaScript with some hardcoded values.
AwareApp.viewDocument (BOName, BOID, BOAttributeStoringPDF)
To test it out, you could use an operation button that executes JavaScript with some hardcoded values.
AwareApp.viewDocument (BOName, BOID, BOAttributeStoringPDF)
VocalDay Solutions - Agility - Predictability - Quality
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Re: how can i view a PDF Attachment directly from the Grid?
Yes, this works quite nicely:johntalbott wrote: ↑Mon Nov 22, 2021 7:03 pm To test it out, you could use an operation button that executes JavaScript with some hardcoded values.
But I need to dynamically get the ID in there. Tried several things.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 620
- Joined: Wed Jun 17, 2015 11:16 pm
- Location: Omaha, Nebraska
- Contact:
Re: how can i view a PDF Attachment directly from the Grid?
This should do the trick.
Code: Select all
const id = parser.m_highlightedRow.refValue.split(":")[1];
AwareApp.viewDocument ("ReqLines", id, "ReqAttachment");
VocalDay Solutions - Agility - Predictability - Quality
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
We specialize in enabling business through the innovative use of technology.
AwareIM app with beautiful UI/UX - https://screencast-o-matic.com/watch/crfUrrVeB3t
Re: how can i view a PDF Attachment directly from the Grid?
yep, thx!
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: how can i view a PDF Attachment directly from the Grid?
Hey Jaymer,
We simply have a process that runs the following command.
DOWNLOAD DOCUMENT BO.DocAttr
If its a PDF it will open in the browser.
We simply have a process that runs the following command.
DOWNLOAD DOCUMENT BO.DocAttr
If its a PDF it will open in the browser.
Re: how can i view a PDF Attachment directly from the Grid?
Thx K
Yes, thats more what I was originally thinking. I rarely (if ever) use DOWNLOAD DOCUMENT. Early on, I was thinking I'd make a report with the Document inside it, then DISPLAY DOCUMENT. Less than ideal. So I asked here thinking I was missing something obvious - which I was.
I tried it, but I like it my original way... for these reasons:
1) Even on my machine, it downloaded the file, requiring a click to open it. Would hate to hassle with a group of users and make them install the viewer plugin (or whatever settings allow it to auto display)
2) Opened in new tab - vs. Popup. I actually like the popup in this case to briefly view the PDF.
My Code (with help from John):
--> JaymerTip Display PDF directly from Grid
Yes, thats more what I was originally thinking. I rarely (if ever) use DOWNLOAD DOCUMENT. Early on, I was thinking I'd make a report with the Document inside it, then DISPLAY DOCUMENT. Less than ideal. So I asked here thinking I was missing something obvious - which I was.
I tried it, but I like it my original way... for these reasons:
1) Even on my machine, it downloaded the file, requiring a click to open it. Would hate to hassle with a group of users and make them install the viewer plugin (or whatever settings allow it to auto display)
2) Opened in new tab - vs. Popup. I actually like the popup in this case to briefly view the PDF.
My Code (with help from John):
Code: Select all
var theID = parser.m_highlightedRow.refValue.split(":")[1];
AwareApp.viewDocument ('ReqLines', theID , 'ReqAttachment')
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL