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 pass data from api to angular-2-data-table #3

Open
vardhineedik opened this issue Feb 17, 2017 · 4 comments
Open

how to pass data from api to angular-2-data-table #3

vardhineedik opened this issue Feb 17, 2017 · 4 comments

Comments

@vardhineedik
Copy link

Hi all,

below is my result JSON from api. how to bind this data to Datatable please help me .

[{"Building":"B85","DeviceID":"402072","PumpNo":3,"EventDateTime":"2017-01-30T23:16:00"},{"Building":"B85","DeviceID":"402072","PumpNo":6,"EventDateTime":"2017-01-30T23:17:00"},{"Building":"B85","DeviceID":"402072","PumpNo":7,"EventDateTime":"2017-01-30T23:17:00"},{"Building":"B85","DeviceID":"402072","PumpNo":8,"EventDateTime":"2017-01-30T23:09:00"}]

@codingpajamas
Copy link

did you solve this? I have the same issue right now.

@bofcarbon1
Copy link

bofcarbon1 commented Nov 1, 2017

in DEMO1

itemResource = new DataTableResource(persons);

The only example I see uses a hard coded Json string array 'persons' that is assigned when the itemResource object is created. I don't understand why 'DataTablResource' which seems like it is the import for the tool component would have a dependency on local data.

I am pulling my table data content from an observable that has a callback that parses the Json
data returned and converts it to a object that I can use in an ngfor loop. So i'm not sure how
that converts to using the data table here but i got stuck with this. I should be swapping the
persons object for my converted object but I am getting a typescript error telling me that itemResource
is undefined.

Seems like I can only use this Data Table 2 if create an object with data before I actually get
that data in my ngInit function.

@ddurette
Copy link

You need to this with your JSON results:

this.resultsResource = new DataTableResource(this.results);

That's what I do and it works.

@asad11111
Copy link

@bofcarbon1 did u resolve this issue. I'm stuck

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

No branches or pull requests

5 participants