How to get another column's value when adding a link to a column's value

How to get another column's value when adding a link to a column's value

greenman123greenman123 Posts: 15Questions: 7Answers: 0

Hey,

Brilliant plugin.

I have this code which adds a link to a column's values:

columnDefs: [
{
    targets: 0,
    render: function (data, type, row, meta)
    {
        if (type === 'display')
        {
            data = '<a href="FormToEdit.php?everything=' + encodeURIComponent(data) + '">' + data + '</a>';
        }
        return data;
    }
}],

I have a column next to this with an ID value, I'd like to use that ID value where the link in the column is "everything=OTHER-COLUMN-VALUE" - how can I do this?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    The third parameter, row, contains all the data for the row, so you can grab it from there,

    Colin

  • greenman123greenman123 Posts: 15Questions: 7Answers: 0

    Brilliant!!! - thanks :)

This discussion has been closed.