jQWidgets Forums

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts

  • rlopez
    Participant

    Hi.
    I’m starting with jqWidgets.
    Hope this helps

    
    source: any;
    dataAdapter: any;
    records: any[];
    entidadRolTipoTree: any[];
    @ViewChild('myTree') myTree: jqxTreeComponent;
    
    getEntidadRolTipoTree(): any {
            this.pgql.query(this._service.entidadRolEstructuraQuery(1)).subscribe(response => {
                    if (response.ok) {
                        this.entidadRolTipoTree = response.body.data.getEntidadRolTree.nodes;
                        this.source = {
                            datatype: 'json',
                            datafields: [
                                {name: 'id'},
                                {name: 'parentid'},
                                {name: 'text'}
                            ],
                            id: 'id',
                            localdata: this.entidadRolTipoTree
                        };
                        // create data adapter & perform Data Binding.
                        this.dataAdapter = new jqx.dataAdapter(this.source, {async: true, autoBind: true});
                        // specifies the mapping between the 'text' and 'label' fields.
                        this.records = this.dataAdapter.getRecordsHierarchy('id', 'parentid', 'items', [{name: 'text', map: 'label'}]);
    
                        this.myTree.source(this.records);
    
                    }
    
                },
                err => {
                    throw err;
                });
        }
    
      ngOnInit() {
            this.getEntidadRolTipoTree();
        }
Viewing 1 post (of 1 total)