[QUESTIONS] change attribute value that is generated through trait
Question
Now, let's consider that I wrote new into the trait value but in attribute :items, I want to append prefix like item.text. to that value So, my final attribute :items become item.text.new. Is that possible?

Answers (3)
I'd say it's enough just this
getValueForTarget: function() {
return 'item.text' + this.model.get('value');
}
You should be able to achieve it via a custom trait, eg. by overriding getValueForTarget method
I tried creating custom trait and override a method but didn't see any attribute generated. can you please look at this code and correct me if there's any error. When I write data in traits it should generate attribute as ':text=item.text.data' at datatextfield.
getInputEl: function() {
if (!this.inputEl) {
var input = document.createElement('textarea');
input.value = this.target.get('content');
this.inputEl = input;
}
return this.inputEl;
},
/**
* Triggered when the value of the model is changed
*/
onValueChange: function () {
this.target.set('content', this.model.get('value'));
},
getValueForTarget: function() {
console.log("inside getValueForTargetss")
return this.model.get( 'item.text' + 'value');
}
});

Related Questions and Answers
Continue research with similar issue discussions.
Issue #374
Is it possible that I change value in traits that will directly reflected in component?
Like If I created drop-down in traits and with a select value of dropdown I want to change the text that is present in that component witho...
Issue #1951
[QUESTIONS] change or add event on add component from block
is it possible ?, change the drag and drop event to on click when adding a new component, I want to add components by clicking the block th...
Issue #1639
[Question]: Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Issue #689
Change value of attribute that is passed through traits
Hello @artf Is there any methods to manipulate the input value of an attribute that is passed through traits. Like I passed value Hello in...
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.