Issue
on TypeScript i'm trying to concatenate two properties into one column, is it possible?
For example, i have "Dog" and "Cat" properties and i want to show both into a single column named "Animals" in the matTable.
So in a single cell of the column "Animals" i'm going to see "Dog, Cat".
Here i made two separate columns but I'm not sure how to see more than one property in the same cell:
configureColumns() {
this.columns = [
{
key: "Dog",
display: "Dog",
styles: { flex: "0 0 10%" }
},
{
key: "Cat",
display: "Cat",
styles: { flex: "0 0 10%" }
},
Solution
I solved my own problem by using the "value" property of the package:
{
key: "DogCat",
display: "Animals",
styles: { flex: "0 0 25%" },
value: (animal: AnimalDTO) => animal.Dog + ", " + animal.Cat
}
This is going to give me exactly the result i was looking for.
Thanks Oscar for your answer, much appreciated.
Answered By - Jany
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.