Nested Object Posting [object Object] to Row
Nested Object Posting [object Object] to Row
Hello,
I have changed up some column values that I am GETTING from a SharePoint list. The main, change that I had made to the columns was allowing there to be more than one selection for some of the choice fields. Since I am dealing with Company's/Capabilities/Customers/etc. there can obviously be more than one for the same item, so have it post multiple to one row, instead of having to enter 3 different items for example, all you need to do is enter one.
I have created an example in JSFiddle with my own JSON Object as my data source: Where there is a nested Capability object within the initial object just like my actual data being pulled: https://jsfiddle.net/BeerusDev/076umdh9/25/ it is still posting object Object.
This question has an accepted answers - jump to answer
Answers
Doing a small amount of debugging the contents to the
group
variable you are displaying in the RowGrouptr
shows this:The example is here:
https://jsfiddle.net/021Lduqj/
You will need to use Javascript methods to extract the information from the
results
array that you want to display.Kevin
Hi,
The issue is that you are pointing DataTables at an object for the
Capability
- e.g. it is:To render a comma separated list from that you could use:
'Capability.results[, ]'
https://jsfiddle.net/CloudTables/w6s8hLgb/
The key here is that you can't just use
===
to compare objects, which is whatdataSrc: 'Capability'
basically does.I'm not convinced this is going to be what you want though? It seems to me like your Capability results are tags - is that right? So you'd actually be looking for a row to potentially be in two groups? That isn't how DataTables works I'm afraid - for that, you'd probably be better to use our search extensions such as SearchBuilder or SearchPanes to allow searching and matching by tags.
Allan
@allan thank you! I had fixed it prior to Kevin answering, but I had not included the [, ]. Before that, it would post the data a bit funky, but that did the trick!