How to render multiple data sources in the same column?

How to render multiple data sources in the same column?

responsivelabsresponsivelabs Posts: 31Questions: 8Answers: 0

I've got a certain column that requires me to build a URL using 4-5 data sources from a JSON file. I'm currently using the columns.render option to accomplish similar for another column, but that one only requires a single data source. This is what i'm using for the single data source column render:

{ data: 'id', render: function ( data, type, row, meta ) {
      return '<a href="id='+data+'&modal" target="_blank">View</a>';}}

So how would I accomplish this same thing, but with say 4 separate data sources? Ive tried using data[0], data[1], etc and setting data to null, but they just come back as undefined. Anyone have any experience with this?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
    Answer ✓

    Based on your other thread you are using objects with columns.data. using data[0] is to access an array based structure. You need to use something like data.myKey or data[myKay].

    Kevin

  • responsivelabsresponsivelabs Posts: 31Questions: 8Answers: 0

    Thank you :smile: this worked, and my project is coming together quite nicely!

This discussion has been closed.