GigaTables/reactables

Data Source from outside of table

andreastoermer opened this issue · 3 comments

When I understand everything in your table solution the only way to get the table data is through an api request configure in directly in table setting. is there a way to include a second method to get the table data by getting them with an existing data object?

At the moment I'm searching for a table solution, but the data object already exist.

Hi, actually there is no other way then to import data via api-call at this moment.
What do u mean by data object? In terms that there are a lot of different object structures.
The data must be consistent to one input format, otherwise it will be error prone.
GT gets list of rows with rows array, it can be enhanced to accept prepared object with rows list, but there will be issues with editor, u can't edit object which won't change state etc.
As u can see there are a lot of tech reasons for that, even if make GT to accept json objects created in app, we should disable editor, leaving only view ability.

PS I think it definitely can be observed as future perspective, actually there were similar questions in issues.

If I understand it right, the actual solution is an api call, which will response with a json which have the structure:

{ rows: [ { key1: 'value1', key2: 'value2', ... }, { key1: 'value1', key2: 'value2', ... }, ... ] }

This structure can also be in generated outside of the table.

You can put this outside object inside the table state, I don't see a difficult where the data object came from, the structure must be the same, and then you can work wth it.

https://github.com/GigaTables/reactables/releases/tag/2.5.1
Now u can set settings.data = ... which will be prioritized over settings.ajax object/string even if present. Thx for idea.