0
有没有办法在formatter函数中使用this
运算符?我的意思是this
对使用格式化程序的组件的引用。例如,我得到这个代码:。这里面fromatter功能
metadata : {
//includes : [ "../../css/orgstructure.css" ],
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 : [ {
path : "SHORT_TEXT",
type : new sap.ui.model.type.String()
}, {
path : "ID",
type : new sap.ui.model.type.String()
} ],
formatter : function(text, id) {
if (text != null && id != null) {
if(this.getProperty("showId)){
return text + " (" + id + ")";
}else{
return text;
}
}
return "";
}
})
})
当我想用this.getProperty("showId)
我得到一个异常访问属性showId
,这个功能并不存在this
。我知道如何绑定this
到事件的功能,但是当函数被调用这个样子,我#已经得到了不知道如何处理这一点;)
呃这么简单:)谢谢你帮助我 – Chris