File Browser - ryanteo96/ionic-json-file-browser GitHub Wiki

Importing Data

Ionic JSON File Browser would need 2 JSON objects: Node and Entity, to generate the File Browser. An example of the JSON object is shown below.

Node JSON

[
 {
    "id": "0",
    "parent": "",
    "child": ["1", "2", "3", "4"]
 },
 {
    "id": "1",
    "parent": "0",
    "child": []
 },
 {
    "id": "2",
    "parent": "0",
    "child": []
 },
 {
    "id": "3",
    "parent": "0",
    "child": []
 },
 {
    "id": "4",
    "parent": "0",
    "child": []
 }
]

Note: An empty string on the parent field would indicate that the item does not belong to any parent.

Entity JSON

[
 {
    "id": "0",
    "name": "Rutledge",
    "type": "folder"
 },
 {
    "id": "1",
    "name": "Sybil",
    "type": "file"
 },
 {
    "id": "2",
    "name": "Wong",
    "type": "pdf"
 },
 {
    "id": "3",
    "name": "Banks",
    "type": "archive"
 },
 {
    "id": "4",
    "name": "Clarke",
    "type": "word"
 },
]

Note: The id field is corresponding to the id field in the Node JSON object.

Generating File Browser

As you saw in the example in the homepage, we used this function to generate the File Browser.

this.fileBrowser.generateFileBrowser(node, entity, "0");

Syntax

generateFileBrowser(node, entity, id)

Argument Details

Argument Type Description
node JSON object Imported JSON object containing information of the nodes
entity JSON object Imported JSON object containing information of the entities
id String Id of node to render at the start of the file browser