jquery - Table Tree in angular2 -
i trying make tree table in angular 2 using jquery-treegrid. 1. added jquery-treegrid dependency on package.json. 2. install typescript jquery library: tsd install jquery 3. add html code:
<table class="tree"> <tr class="treegrid-1"> <td>root node</td><td>additional info</td> </tr> <tr class="treegrid-2 treegrid-parent-1"> <td>node 1-1</td><td>additional info</td> </tr> <tr class="treegrid-3 treegrid-parent-1"> <td>node 1-2</td><td>additional info</td> </tr> <tr class="treegrid-4 treegrid-parent-3"> <td>node 1-2-1</td><td>additional info</td> </tr> </table>
my component class:
declare var jquery:any; @component({ selector: '[configuration]', template: require('./configuration.html'), encapsulation: viewencapsulation.none, styles: [require('./configuration.scss')], directives: [widget, tablesbackgrid, datatabledirectives], providers: [configurationservice, http_providers], pipes: [searchpipe] }) export class configuration implements afterviewinit, oninit { data: isystem[]; errormessage: string; constructor(private configurationservice: configurationservice, private rootnode: elementref) { } ngafterviewinit() { jquery(this.rootnode.nativeelement.find('.tree')[0]).treegrid(); } ngoninit(): void { this.configurationservice.getsystems() .subscribe(systems => this.data = systems, error => this.errormessage = <any>error); } }
errors in console:
typeerror: this.rootnode.nativeelement.find not function
i following answers on forum , didn't work. others plugins run table tree in angular2?
i guess should be
jquery(this.rootnode.nativeelement).find('.tree')[0].treegrid();
(moved )
)
Comments
Post a Comment