How to combine cells or use 2 data in one cell

How to combine cells or use 2 data in one cell

brabusbrabus Posts: 3Questions: 1Answers: 0
edited April 2015 in Free community support

Hi,
for instance i got the following data my application receive by an ajax request:

{
    "name":       "Tiger Nixon",
    "link":           "example1.com"
    "address":   "n.a.",
    "age":          "40",
},
{
    "name":       "J.D.",
    "link":           "example2.com"
    "address":   "n.a.",
    "age":          "20",
}

now I want the name to be a link in my table, but every name has another Link.
How can I get the value of link in the rendering of the name?

e.g.:

"columns": [
                {"data": "name",
                "render":function(data){

                            return '<a href="'+//**here should be the link**//+'">'+data+'</a>' ;

                } },

output:

[name]                          [address]           [age]
[Tiger Nixon](example1.com)           n.a                 40
[J.D.](example2.com)                   n.a                 20

Thank You

This question has an accepted answers - jump to answer

Answers

  • brabusbrabus Posts: 3Questions: 1Answers: 0

    Is there realy no way of doing this?

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    Answer ✓

    if i read your field names right, try...

    { data: null,
            "render": function ( data, type, full, meta ) {
                    return '<a href="mailto:'+data.Address+'">'+data.Name+'</a>';
            }
    }
    
  • brabusbrabus Posts: 3Questions: 1Answers: 0

    perfect, thank you very much!

This discussion has been closed.