Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to assign web api result to this.table = ? #6

Open
shijilesh opened this issue Mar 18, 2017 · 1 comment
Open

how to assign web api result to this.table = ? #6

shijilesh opened this issue Mar 18, 2017 · 1 comment
Labels

Comments

@shijilesh
Copy link

shijilesh commented Mar 18, 2017

here is my component and my database table name is faacc0001.

how i can assign values to this.table =.

Please help
Thanks
Shizil

import { Component, OnInit } from '@angular/core';
import { FAAC0001Service, faacc0001 } from './FAAC001.Service';
import { Subscription } from 'rxjs/Subscription';
import { BasewindowComponent } from '../base/basewindow.component';
import { Http } from '@angular/http'
import { NgDataGridModel } from 'angular2-datagrid'; 

@Component({
    selector: 'FAAC0001',
    templateUrl: './FAAC0001.Component.html'
})

export class FAAC0001Component extends OnInit  {
subscription: Subscription;
    table: NgDataGridModel<faacc0001>;
  
    refresh() {
        this._service.LoadData().then(data => {
            this.faacc0001s = data;
        })
        
    }
    constructor(private _service: FAAC0001Service) {
        super();
        this.subscription = _service.RegenerateData$.subscribe(
            mission => {
                console.log("Good !! ", mission);
                this.refresh();
            });
    }

    ngOnInit() {
        this.refresh();
    }

faacc0001s: faacc0001[] = [];
}
@jmvtrinidad
Copy link
Owner

You can assign your data using items property in your DataGrid instance.
In your constructor class or method it will look something like this

constructor(){
    //code for requesting data here using async await keyword or
    // inside your then from promise or subscribe from observables.
    this.table.items = items;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants