Undefined error when combining data from column 4 with that of 3

Undefined error when combining data from column 4 with that of 3

stichcomberstichcomber Posts: 24Questions: 6Answers: 3

I would like to combine column 4 data with column 3. I get "undefined" by the data in column 3. I have tried columnDefs and columns and both return the same. Also, I cannot find an explanation of function ( data, type, row ) and function ( data, type, full, meta ) . Any help much appreciated.

$(document).ready(function () {

                         $('#myDataTable').dataTable( {
                             
                            "ajax": "json_get_countries",

                            // country column does not work as expected.  It shows "undefined" and a hyperlink 
                            // connected to the word underdefined 
                            "columnDefs": [

                                    // COUNTY_ID
                                    { 
                                         "targets": 0,
                                        "data": "country_id",
                                        "searchable" : false 
                                    },

                                    // COUNTRY
                                    {   
                                         "targets": 1,
                                        "data": "country", 
                                        
                                        "render": function ( data, type, full, meta ) {
                                            return '<a href="'+data+'">'+data+'</a>';
                                        } 
                                    },

                                    //COUNTRY_ENABLED
                                    { 
                                         "targets": 2,
                                        "data": "country_enabled",

                                        "render": function ( data, type, row ) {
                                                return data +' ('+ row[3]+')';
                                        }

                                    },

                                    //numberOfDestinations
                                    { 
                                         "targets": 3,
                                        "data": "numberOfDestinations" ,
                                        "visible": false
                                    }
                              ]

                        } );
            });

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.