TreeTable

UI Components for Angular
Post Reply
lenoil
Posts: 1
Joined: 20 Sep 2017, 10:10

20 Sep 2017, 10:18

He,

I try to use Treetable component

Code: Select all

<p-treeTable [value]="files">
    <p-column field="label" header="Name"></p-column>
    <p-column field="size" header="Size"></p-column>
    <p-column field="type" header="Type"></p-column>
</p-treeTable>
and my code in my typescript

Code: Select all

import {
    TreeTableModule,
    TreeNode,
    SharedModule
} from 'primeng/primeng';

@Component({
    selector: "sample-form",
    templateUrl: "./sample.html",
    styleUrls: ["./sample.css"]
})

export class Sample implements OnInit, OnDestroy {

  
    files: TreeNode[];
 

    constructor() {
       
    }

    ngOnInit() {
       
        this.files  = require("./files.json") as TreeNode[] ;
       
       console.log(this.files);
    }
}
And also, add the command line in my app.module

Code: Select all

import { NO_ERRORS_SCHEMA } from '@angular/core';
to can use the component

In my html page I don't see the treetable no error ....

My files.json is:

Code: Select all

{
    "data":
    [  
        {  
            "data":{  
                "name":"Documents",
                "size":"75kb",
                "type":"Folder"
            },
            "children":[
                {  
                    "data":{  
                        "name":"Work",
                        "size":"55kb",
                        "type":"Folder"
                    },
                    "children":[  
                        {  
                            "data":{  
                                "name":"Expenses.doc",
                                "size":"30kb",
                                "type":"Document"
                            }
                        },
                        {  
                            "data":{  
                                "name":"Resume.doc",
                                "size":"25kb",
                                "type":"Resume"
                            }
                        }
                    ]
                } .....

What's the problem
Do you have a idea ?

Thanks

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

25 Sep 2017, 12:18

Do you have a service file or something similar? For example; PrimeNG TreeTable has NodeService (https://www.primefaces.org/primeng/#/treetable)

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

25 Sep 2017, 14:50

Please create a plunker example to find the issue. Do you find any errors through Dev Tools?
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests