Through sightly I printed a list of textarea values entered via dialog as follows:
<sly data-sly.use.commenti=${resource.path}/commenti>
<sly data-sly.list.commento="${commenti.listChildren}">
<p> Comments: ${commento.testo}</p> "Testo" is the value in the dialog inside the textarea. In the model instead I inserted the testo variable, getter and setter and the "modifyText" method. Now, without creating a list in the model, I would like to print these modified values using sightly
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
@Vodjakxa : Can you please rephrase your question? I am unable to follow what you have to do with this.
thank you.
Views
Replies
Total Likes
The code I wrote is to print a list of values entered from the dialog. I would then like to print these same modified values via a simple method I have in the sling model, but without creating a list in the model. I would like to always print using sightly. Thanks!
Views
Replies
Total Likes
@Vodjakxa :
In sling model
@Model(adaptables = SlingHttpServletRequest.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class ModelClass {
@RequestAttribute
private String value;
public List<String> getListChildren(){
// create list of values based on dialog values;
return listofValues;
}
public String getModifiedValue(){
return modifyOriginalValue(value);
}
private String modifyOriginalValue(String val){
//custom logic to modify the value;
String modifiedVal = val + "some random text";
return modifiedVal;
}
}
In Sightly, please try with something like this.
<sly data-sly-use.commenti="${'com.project.ModelClass'"/>
<sly data-sly.list.commento="${commenti.listChildren}">
<!-- list item value>
${item}
<!-- modified item value>
${commenti.modifiedValue @value=item}
</sly>
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies