[Question] I am updating trait using addTrait function? It updates and adds the trait in trait manager but unable to reflect it in html section of codeManager?
Question
I have written the following code -
const component = editor.getSelected();
component.addTrait({
name: 'traitName',
type: 'text', label: 'traitLabel', value: 'traitValue'
});
const traits = component.get('traits');
traits.forEach(trait => console.log(trait.props()))Answers (1)
Traits change the component (and its final HTML) when you use them. By simply updating traits collection in the component doesn't make any change to it on the HTML side
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2333
can't able to remove the added traits properties[QUESTION]
Hi, I can able to add the traits properties dynamically by using the following code. but the following code to remove the type name is not...
Issue #3237
Add Trait For wrapper
Hi @artf I've added trait for wrapper this way. How can I perform the init function for the same Here is the code @artf Could you please he...
Issue #1977
[QUESTION] gjs-component is not updated with my traits values
Hi, have I modified my HTML using the toHTML function in traits. An HTML element is updated but the gjs-component is not updated still it s...
Issue #1586
[Question] update Trait select option dynamically
I tried this to update trait selection. var updateTrait = function(id, name) { var typeTrait = model.get('traits').where({name: 'type'})[0]...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.