how to add link for each row ?

how to add link for each row ?

bussierebussiere Posts: 1Questions: 1Answers: 0
edited July 2016 in Free community support

Cid is in array with links how to parse cid and put each value as a link instead url in the funtion in mrender ?

My code :

  var data_in_table = {
                "cid" : cid,
                "aaData": [
                ],
                "aoColumnDefs": [{
                    "aTargets": [0]
                    , "bSortable": true
                    , "mRender": function (url, type, full,cid) {
                        return '<a href="' + url + '">' + url + '</a>';
                    }
                },{
                    "aTargets": [3]
                    , "bSortable": true
                    , "mRender": function (data, type, full) {
                        return data;

                    }
                }]
            };
            console.log("data_table",data_table['aaData']);
            data_in_table["aaData"] = data_table['aaData'];
            $('#table_data').dataTable(data_in_table);

and i imagine that i would like something like this :

var data_in_table = {
                "cid" : cid,
                "aaData": [
                ],
                "aoColumnDefs": [{
                    "aTargets": [0]
                    , "bSortable": true
                    , "mRender": function (url, type, full,cid) {
                        return '<a href="' + cid[i] + '">' + url + '</a>';
                    }
                },{
                    "aTargets": [3]
                    , "bSortable": true
                    , "mRender": function (data, type, full) {
                        return data;

                    }
                }]
            };
            console.log("data_table",data_table['aaData']);
            data_in_table["aaData"] = data_table['aaData'];
            $('#table_data').dataTable(data_in_table);

how to get the i ?
Regards and thanks

Answers

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    Its virtually impossible to say for certain without a link to a test case, as required in the forum rules, but you probably need to do something like full[ index ] where index is the data index that contains the URL.

    Allan

This discussion has been closed.