Issue #2727Opened April 22, 2020by adamwpe6 reactions

[BUG] Custom Component Class is not being rendered unless trait changes

Question

I think this is a bug,

Basically, I have a custom component that has an attribute of a class ('gjs-button'), but that class only appears to get rendered/applied when a trait is changed.

  1. Drag and drop the component: Capture1

  2. Amend the component Trait. Capture3

  3. The component is rendered again, but now you can see the class 'gjs-button' has been applied. Capture4

I've created an example: https://jsfiddle.net/tb2gyas8/3/

Is that a bug? Or is there something wrong messing up the component?

Thanks Adam

Answers (3)

pouyamiralayiApril 23, 20204 reactions

Hi @adamwpe please use classes attribute instead of attributes:

//...
resizable: true,
editable: true,
hoverable: true,   
classes:['btn','gjs-button'],
//...

Cheers!

adamwpeApril 24, 20202 reactions

Oh Thanks, @pouyamiralayi,

Seen someone used attributes and assume that was the correct method - worked like a charm!

adamwpeApril 22, 20200 reactions

Appears a similar thing happens on save and reload. With this custom component, you are allowed to amend the size, but when you save and reload, the renderer doesn't draw it to the correct size, even though it has saved the correct width:

Before Save: Capturea

On Reload (It has the correct width): Captureb]

If I then change the trait, it will then default back to its original settings (AKA losing the width).

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.