Issue #3052πŸ’¬ AnsweredOpened September 30, 2020by MudassarSandhu0 reactions

Hide/show traits and change their values dynamically

Quick answerby artf

You've called the trait name: 'select-type', but you're listening to change:selectType, so fix it by changing the listener in change:select-typeDon't rely on the trait value this.getTrait('select-type').props().value but on the component itself this.get('select-type') Currently you can't update traits attributes in th...

Read full answer below ↓

Question

I have extended the link component and add new traits like href. In order to show or hide the trait i followed this #https://github.com/artf/grapesjs/issues/1460. But how to show those hide traits again on the basis of another trait change value? Right now what i have done is But its not reflecting the changes in the component setting. Can we change the style of trait like hide/show dynamically. Can we assign select-type trait value to path-name trait value or do i need to implement custom types for that?

Answers (2)

artfβ€’ October 10, 2020

You've called the trait name: 'select-type', but you're listening to change:selectType, so fix it by changing the listener in change:select-typeDon't rely on the trait value this.getTrait('select-type').props().value but on the component itself this.get('select-type') Currently you can't update tra...

chaegumiβ€’ January 12, 2023

getTrait('ID').view is undefined.

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.