0

what I'm seeing in the developer's consoleIn app maker I have created a drive picker to add project files to a project tracking app. I have everything working the way I want to (thanks to some app maker samples & videos) except for the icon of the document. When I use the picker to select a file, or multiple files, the selected files are then shown in a list above the picker. File name, url link both work but icon will not show up. Any ideas? I've been working on this seemingly minor thing for hours with zero luch.

I have a model, called Files, set up. In it I have Name, Url, and Icon. In the properties for the picker, I have name and url bound to the appropriate datasource items and I have the following code bound to onDocumentSelect. I got that code from a video where a guy was doing basically what I'm doing except it worked on his. I've watched the video a hundred times probably to see if there's anything I did different.

widget.datasource.item.icon = result.docs[0].iconUrl;
widget.datasource.createItem();

This should retrieve the icon of the selected docs, after they're selected, and create the icon item in the datasource. What am I doing wrong? Or is there another or better way to do this?

  • That should work just fine. What type of document are you selecting? Does it work for some or for none? Are you using an image widget to view the icon? – Morfinismo Aug 06 '19 at 18:55
  • That's what I thought, I've tried documents, sheets, pdfs, none of them work. I am using an image widget – Giuseppe Baldi Aug 06 '19 at 19:12
  • Are you at least getting a value or is it totally null? What does the object looks like in the developer console when you do a `console.log(result.docs[0])`? Can you update your question with the result please? – Morfinismo Aug 06 '19 at 19:15
  • Ok, not sure I'm doing this right (I'm self taught) but here's what I seem to be getting in the console: Tue Aug 06 14:40:01 GMT-500 2019 [object Object] – Giuseppe Baldi Aug 06 '19 at 19:40
  • You are not. You are supposed to open the web browser developer's console and see the result there. The app maker console won't show you what I need. – Morfinismo Aug 06 '19 at 20:44
  • Gotcha, thank you for pointing me in the right direction, your help is much appreciated. When I click on the Drive picker to select a file I am getting 2 errors. – Giuseppe Baldi Aug 07 '19 at 14:54
  • first error is 'cb=gapi.loaded_0:139 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://docs.google.com') does not match the recipient window's origin ('https://n-5ufo5uw25dfu4jdszkt4zqaejivyqvi5zxggani-0lu-script.googleusercontent.com').` – Giuseppe Baldi Aug 07 '19 at 14:58
  • Can you please update your question and post a screen shot of what you see on the developer's console after you select the file. I still need some more information. – Morfinismo Aug 07 '19 at 15:00
  • and another regarding Invalid 'X-Frame-Options'. When I actually select a file I get no errors but I am getting this in under iconUrl: "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.spreadsheet" – Giuseppe Baldi Aug 07 '19 at 15:00
  • Updated the original post with a screenshot, thank you! – Giuseppe Baldi Aug 07 '19 at 15:10
  • So, I just fixed it. In the original code I had 'widget.datasource.item.icon" , I didn't think it would matter but I changed the i in icon to I (widget.datasource.item.Icon) and that fixed it. Thanks a million for your help and for explaining to me how to use the console! Much appreciated! – Giuseppe Baldi Aug 07 '19 at 15:15
  • I see. The error all along was a Type in your code. The upper case **I** does matter so becareful with this type of things in the future. – Morfinismo Aug 07 '19 at 15:20

0 Answers0