Answer the question
In order to leave comments, you need to log in
How to work with Client-Side HTML in Google Script?
Good afternoon. Tell me how to solve
There is table1 , table2 , library1 , library2 .
Library1 has code to create a modal window, for example named show ().
In the window I form an object and send a callback to a function that saves the answer in tables
1) In table1, if I call as
, then I get it in the log:
Moreover, this is not from a function, I use my own logger and gives more information there
If I call from the menu
, then the function is executed no problem UPD: [in the example this construction works fine, but not in the source file]
lib.show()
Информация: False
('Показать окно', 'lib.show')
2) library2 is nested in library1 , but its functions do not participate in the window call or further work. However, I get different errors: access or "404 NOT FOUND" depending on whether I select library2 in developer mode or just deploy with a version number
3) All this works on my account, but does not work on the account of the owner of all files.
4) I decided to make copies of the files, at the first start I gave out the rights, now the window is normally shown, but when I call it from the window,
google.scrip.run.callback()
an error occurs
"ScriptError: Для выполнения этого действия необходима авторизация."
google.scrip.run
.withSuccessHandler(google.script.host.close)
.withFailureHandler(alertError)
[callback](data);
Answer the question
In order to leave comments, you need to log in
1, 3, 4 is one problem. The user must run any function from the library in order to authorize it.
5 is the most interesting thing. When you create a Ui from a lib, you lose the user's context by entering the lib's context. When the UI calls the Client-Side API, it accesses the root context. If there is no named function there, then there will be no execution, but if the name is found, then the execution is transferred to the server side, where the required context is returned. But it is also truncated, for example, this context does not know about active Tables and Documents.
At the moment, I have not been able to get a fully functional application that would work with Ui from the library.
I consider the only "more or less" option to be the delivery of the code from the lib and its eval. What is fraught, and obviously, breaks the essence of the goal of this undertaking.
The topic excites the minds https://oshliaer.github.io/qna?mnemo=gas&target=44...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question