Hi, I’m starting to try Vaadin 14, I’m trying to create an addon that uses the Gantt from DHTMLX (https://docs.dhtmlx.com/gantt/). I have created a polymer project that successfully displays the Gantt, then I’m trying to call that web component from a Vaadin Addon project by adding the js file. The Addon project structure looks like the attached file. The code using the web component is this:
package com.neotropic.vaadin14.component.addon.gantt;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dependency.NpmPackage;
@Tag("gantt-web-component")
@JsModule("./gantt-web-component.js")
@NpmPackage(value = "dhtmlx-gantt", version = "^6.2.6")
/*
If you wish to include your own JS modules in the add-on jar, add the module
files to './src/main/resources/META-INF/resources/frontend' and insert an
annotation @JsModule("./my-module.js") here.
*/
public class PaperSlider extends Component {
public PaperSlider() {
}
}
Then I created a demo project with Vaadin 14 - Spring Boot that on the MainView creates a PaperSlider object and add it to its layout.
package com.neotropic.gantt.demo.spring;
import com.neotropic.vaadin14.component.addon.gantt.PaperSlider;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.dependency.NpmPackage;
import com.vaadin.flow.component.notification.Notification;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.server.PWA;
@Route
@PWA(name = "Project Base for Vaadin Flow with Spring", shortName = "Project Base")
@NpmPackage(value = "dhtmlx-gantt", version = "^6.2.6")
public class MainView extends VerticalLayout {
public MainView(@Autowired MessageBean bean) {
// Button button = new Button("Click me",
// e -> Notification.show(bean.getMessage()));
// add(button);
add(new PaperSlider());
setSizeFull();
}
}
If I run the demo it succesfully loads the gantt structure but it can’t load the CSS file that has to come from the DHTMLX-Gantt NPM Module so everything looks like a mess, like dozens of words one over the other. Is my process wrong? or there is something I’m missing in order to succesfully load the CSS file?