Re-render trait on selected component
Question
I know there is a function that can rerender the view of a trait. However, I still don't know how and where to use it.
this.editor.on('component:selected', model => {
const component = this.editor.getSelected();
const models = component.get('traits').models;
// Parsing types
for(var index in models) {
if (models[index].attributes.type == 'typeinput') {
// How to use the view.rerender() function
console.log(models[index].target.view)
}
}
});
Answers (0)
No answers yet.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3185
[QUESTION] How to get the models trait of a component?
Hi there, I added a new type "array" to the TraitManager. So I can add several sub traits. On one point I have to check the traits of the m...
Issue #2819
[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?
I have written the following code - const component = editor.getSelected(); component.addTrait({ name: 'traitName', type: 'text', label: 't...
Issue #1227
Re-render view in editor's canvas whenever Trait value changes
Is there any possible way in grapesjs that whenever a user changes the value of a Trait of a custom component the render function should li...
Issue #2305
Wrap and UnWrap function is not working in Grapesjs selected element
if(data.component.get('tagName') === 'img') { const selectedComponent = editor.getSelected(); const href = this.getHref(); const childHtml...
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.