I need to show some information in a table, the rows in the table must be expandable according to some data.
I have an array like this:
const data = [
['0','some name','ok'],
['0.1','some name','ok'],
['0.1.01','some name', 'ok'],
['0.1.01.01','some name','ok'],
['0.1.01.02','some name','ok'],
['1','some name','ok'],
]
i need to use this dot notation string as the subRows hierarchy so it would looks like:
code decription status
__________________________________
+ 0 some text ok
+ 0.1 some text ok
+ 0.1.01 some text ok
+ 0.1.02 some text ok
+ 1 some text ok
i tried to format the data so it would looks like
const data = [{
code: "0"
name: "some name"
status: "ok"
data:[{
code: "0.1"
name: "some name"
status: "ok"
data:[
{
code: "0.1.01"
name: "some name"
status: "ok"
data: []
},
{
code: "0.1.02"
name: "some name"
status: "ok"
data:[]
}
]
},
{
code: "1"
name: "some name"
status: "ok"
data[]
}
]
}]
but i wasn't able so i'm looking to use something like
const data = [
{
code: "0",
name: "some name",
status: "ok",
id:"0",
parentId:null
},
{
code: "0",
name: "some name",
status: "ok",
id:"0.1",
parentId:"0"
},
{
code: "0",
name: "some name",
status: "ok",
id:"0.1.01",
parentId:"0.1"
}
]
so "id" and "parendId" properties will define collapse subRow
How can i rewrite getSubRow function to take id and parentId?
question from:
https://stackoverflow.com/questions/65713968/how-to-use-getsubrows-and-useexpanded-on-a-table-without-using-subrows-object-pr