我使用的是dev extreme数据网格,如果日期不可用,我会显示空白。如果日期为空,我想显示"-“。
我试过了
// component.html
[customizeText]="customizeMyText"
// component.ts
customizeMyText(cellInfo: any) {
console.log(cellInfo);
if (cellInfo.value == '' || cellInfo.value == null || cellInfo.value == undefined) {
return 'NA';
} else {
return cellInfo.value;
}
}但是它给出了一个错误,text.replace不是一个函数。
发布于 2020-06-12 09:21:21
customizeText函数的返回值需要一个字符串,请将您的函数更改为使用valueText:
customizeMyText(cellInfo) {
if (
cellInfo.value === "" ||
cellInfo.value === null ||
cellInfo.value === undefined
) {
return "NA";
} else {
return cellInfo.valueText;
}};
https://stackoverflow.com/questions/62135609
复制相似问题