I'm planning to create a tree data table for file browser and wondering how to render rows for files in a folder. The data is in a flat list of file paths but I'm able to re-format it to be the same as the structure of the folders.
I am debating if I have to render children of a folder as nested rows inside a row or if I could have them as sibling rows and just modify the padding to indicate the hierarchy?
This is how the data looks like:
[ {
"name" : "Parent Folder",
"path" : "/home/desktop/report",
"size" : 2156754,
"createdOn" : -1,
"fileType" : "FOLDER",
"itemId" : 478202,
}, {
"name" : "nested file",
"path" : "/home/desktop/report/test.js",
"size" : 15402,
"createdOn" : 1595072355000,
"fileType" : "FILE",
"itemId" : 478203,
"parentId" : 478202,
}, {
"name" : "nested folder",
"path" : "/home/desktop/report/build",
"size" : 2141352,
"createdOn" : 1595072355000,
"fileType" : "FOLDER",
"itemId" : 478204,
"parentId" : 478202,
"faulty" : false,
"newItemCount" : 478498,
"itemCount" : 478498
},
{
"name" : "nested folder",
"path" : "/home/desktop/report/build/main",
"size" : 2141352,
"createdOn" : 1595072355000,
"fileType" : "FILE",
"itemId" : 478204,
"parentId" : 478204,
}
]