Hello,
I tried to implement the google api for Books in my project but it failed. I tried multiple ways but due to a lack of experience with CUBA. I haven’t managed to find a solution.
Kind regards
Ricardo Mayorga Mera
Hello,
I tried to implement the google api for Books in my project but it failed. I tried multiple ways but due to a lack of experience with CUBA. I haven’t managed to find a solution.
Kind regards
Ricardo Mayorga Mera
Hi Ricardo,
Please post more details: what you have tried, what works and what doesn’t.
I tried making a search bar with html.
The results would be displayed on the page and depending which book the user picks it would redirect to the right weblink.
This would happen with my javascript file.
I put the html into a htmlbox and tried to put my javascript into the html. But somehow the htmlbox would erase the script part and only output the html on the website.
The only thing I need is a way to link my javascript to the html and if possible my css file as well.
Hi,
The easiest way to integrate custom HTML markup into your application is to use BrowserFrame UI component. You find documentation in our manual: BrowserFrame - CUBA Platform. Developer’s Manual and samples here: https://demo.cuba-platform.com/sampler/open?screen=classpath-browserframe
You can define it in XML as follows:
<browserFrame id="browserFrame"
height="100%"
width="100%"/>
It supports different source types: ClasspathResource, FileResource, UrlResource, etc.
For instance, you can even generate HTML content dynamically:
public class ExtAppMainWindow extends AppMainWindow {
@Inject
private BrowserFrame browserFrame;
@Override
public void init(Map<String, Object> params) {
super.init(params);
byte[] bytes = "<h1>DEMO</h1>".getBytes(StandardCharsets.UTF_8);
browserFrame.setSource(StreamResource.class)
.setStreamSupplier(() -> new ByteArrayInputStream(bytes))
.setMimeType("text/html");
}
}
BrowserFrame will add separate <firame>
element with content into DOM tree and it supports JavaScript tags as usual. In fact, HtmlBoxLayout is aimed for custom layouts with integrated UI components, that’s why it removes all JS nodes from HTML.