The "data" returns as undefined even if it is being provided

The "data" returns as undefined even if it is being provided

Trendy1234Trendy1234 Posts: 1Questions: 1Answers: 0
edited August 2020 in Free community support
app.controller('profiling', function($scope, $http, $window) {
    $(document).ready(function() {
        
        $window.table = $('#table_profile').DataTable ({
            "ajaxSource": "/getProfilesData",
            "columns": [
                {"data": "applicant_id"},
                {"data": "application_type"},
                {"data": "last_name"},
                {"data": "middle_name"},
                {"data": "first_name"},
                {"data": "birth_date"},
                {"data": "address"},
                {"data": "sex"},
                {"data": "date_applied"},
                {"mRender": function (data, type, full) {
                    var editLink = '<a class="editFunction" href="/editProfiles?applicant_id=' + data + '">Edit</a>';
                    var deleteLink = '<script>function deleteButton(){console.log(' + data + ');}</script><button type="button" onclick="deleteButton()">Delete</button>';
                    return (editLink + " " + "  |  " + " " + deleteLink);
                }
                }
            ]
        });
    });
});

Here's the link
http://live.datatables.net/yazuyegi/1/edit

Error Message: Undefined:
I have a script inside deleteLink and Once the button is clicked it returns the data as undefined in the console. But if I use row.applicant_id it displays an id value but only displays the id value for each row in which should not be:

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Can you post the data that the server returns please, or link to your page so we can see the issue.

    Colin

This discussion has been closed.