nested data
See original GitHub issueis it possible to access values in nested data?
i have
[ { fields: { systemWorkItemType: "Feature", systemState: "New", systemReason: "New", systemTitle: "initial work item", systemBoardColumn: "New", systemBoardColumnDone: false, microsoftVSTSCommonStateChangeDate: "2016-12-07T14:02:24.24Z", microsoftVSTSCommonPriority: 2, microsoftVSTSCommonValueArea: "Business", microsoftVSTSCommonRisk: "3 - Low", weF_8107056482E145ECA07BC00173CF6A70_KanbanColumn: "New", weF_8107056482E145ECA07BC00173CF6A70_KanbanColumnDone: false, systemDescription: "a test description" }, id: 2, relations: [ ], rev: 4 } ]
im trying to add the field values into the table but neither "fields[“systemState”] or fields.systemState work?
id and rev come out fine…
e.g. column
{ title: "Name", field: "fields.systemTitle", sorter: "string", sortable: true },
any ideas?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
Hey,
You will be happy to hear that Tabulator 3.2 has just been released, and with it the the ability to bind columns to nested data, simply use dot notation in the field name:
Full information can be found in the Column Definition Documentation
Cheers
Oli
One item to note for anyone wishing to use the function Oli has provided to “flatten” their data structure: There were two typos, which I have corrected in this version.
flatternRow
should readflattenRow
, and the linevar flat = flattenData(row[prop]);
should instead bevar flat = flattenData(row[prop]);
, else the function will fail at the foreach clause when it reaches the first nested object. Hopefully it saves someone a few cycles around the debugger! 😃