Merge column data with nested arrays
Merge column data with nested arrays
Hi, I'm trying to merge two columns. Each has a nested array, which makes "clean" data loading complicated. Here's the function I'm using for rendering:
( data, type, full ) => {
return $.map( data, function ( d, i ) {
return d.given +' '+ d.family;
} ).join( ',<br />' );
}
I also have a JSFiddle online with a working example. As you can see, on the third column, the suggest method for the merge doesn't work. In any case, I would prefer rendering a column with data from both arrays, preferably in the same function, but I cannot see to access them using "full[]arrayname" nor "data[]arrayname".
This question has an accepted answers - jump to answer
Answers
Maybe this updated fiddle will help?
https://jsfiddle.net/zbv4k8yu/4/
Take a look at the console, maybe it will help to look at the row object.
Kevin
Thank your for your answer! Your fiddle wasn't enough, as it only returned the first result of the array. I found a full answer in Stack Overflow, and I used it to customize my first column so that it would return array2 if array1 was blank. A mix of code from any of these will also concatenate easily without having to use columnDefs.