Is there a way to use the this
operator inside a formatter function? I mean with this
, the reference to my component in which the formatter is used. For example, I got this code:
metadata: {
properties: {
// ...
showId : { type : "boolean", defaultValue : true },
// ...
}
}
//Some view stuff ...
columns: [
new sap.ui.table.Column({
label: "Beschreibung ( ID )",
filterProperty: "SHORT_TEXT",
template: new sap.m.Text().bindProperty("text", {
parts: [/*...*/],
formatter: function(text, id) {
if (text != null && id != null) {
if(this.getProperty("showId)){
return text + " ( " + id + " )";
} else {
return text;
}
}
return "";
}
}),
})
]
When I want to access the property showId
with this.getProperty("showId)
I get an exception, that this function not exists for this
. I know how to bind this
to a event function, but when the function is called like this, I've got no idea, how to handle this ;)