pmueller
pmueller

Reputation: 143

Vaadin 14 Sliders

can someone explain me how to add a slider into an vaadin 14 project ? I found out, that the component slider was removed in vaadin 10, so i used this one: https://vaadin.com/directory/component/paper-slider-components

After i added the maven dependency and repository to my pom.xml, i was able to import the slider to my java class.

But if i create an instance of it, it crashes with the following message:

"Couldn't find the definition of the element with tag 'vaadin-paper-slider' in any template file declared using '@JsModule' annotations".

Is there another addon where i dont have to create a html template class? Or can someone explain me how i can create a template class for that slider addon?

Upvotes: 1

Views: 921

Answers (1)

kscherrer
kscherrer

Reputation: 5766

The Addon that you linked to is not compatible with Vaadin 14 (npm mode), only with Vaadin 10-13 and Vaadin 14 (bower mode a.k.a. compatibility mode). The reason for that is that the templates for the PaperSlider and PaperRangeSlider are made with Polymer 2 and haven't been remade for polymer 3. As soon as the author does that, and imports the template using @JsModule instead of @HtmlImport, it will be compatible with Vaadin 14.

If there are no other add ons yet for a slider and if you really need this now and if you don't expect the author to release an update for V14 soon, then you could copy the whole code in the github of said addon and do the migration to V14 yourself. Here is a tutorial how to migrate a polymer 2 template to polymer 3. Looking at the simplicity of the original polymer2 template of the PaperSlider, this should not be too hard to do. You could even publish that as your own addon for Vaadin 14 Slider if you wanted, or make a Pull Request for the existing addon-github.

Upvotes: 6

Related Questions