Skip to content

Commit

Permalink
fix(stark-ui): fixed column issue when rawValue is undefined, cellFor…
Browse files Browse the repository at this point in the history
…matter is not called

ISSUES CLOSED: #1465
  • Loading branch information
SuperITMan committed Dec 17, 2019
1 parent 93ab8f9 commit cae23cb
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/stark-ui/src/modules/table/components/column.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,21 +274,19 @@ export class StarkTableColumnComponent extends AbstractStarkUiComponent implemen
let formattedValue = "";
const rawValue: any | undefined = this.getRawValue(row);

if (typeof rawValue !== "undefined") {
if (this.cellFormatter instanceof Function) {
formattedValue = this.cellFormatter(rawValue, row, this.name);
} else if (typeof rawValue === "number") {
return rawValue; // return already, no point in translating a number
} else {
formattedValue = rawValue.toString();
}
} else {
if (this.cellFormatter instanceof Function) {
formattedValue = this.cellFormatter(rawValue, row, this.name);
} else if (typeof rawValue === "undefined") {
return ""; // return already, no point in translating an empty string
} else if (typeof rawValue === "number") {
return rawValue; // return already, no point in translating a number
} else {
formattedValue = rawValue.toString();
}

return formattedValue;
// TODO: add translation feature
// return this.$translate.instant(formattedValue);
return formattedValue;
}

/**
Expand Down

0 comments on commit cae23cb

Please sign in to comment.