Open vardhineedik opened 7 years ago
did you solve this? I have the same issue right now.
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.
You need to this with your JSON results:
this.resultsResource = new DataTableResource(this.results);
That's what I do and it works.
@bofcarbon1 did u resolve this issue. I'm stuck
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"}]