使用 jQuery Datatables 从 Ajax 调用中的 table 单元格中找到的值设置变量的值

Set the value of a variable from a value found in a table cell within an Ajax call using jQuery Datatables

如何根据在同一行的另一个单元格中找到的值来设置变量的值(或更具体地说 - 每行中的按钮属性)?此示例中的数据正在从 MVC 控制器传递到 Ajax 成功函数:

$.ajax({
            type: "POST",
            url: '@Url.Action("GetData", "Home")',
            cache: false,
            retrieve: true,
            data: data,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            defaultContent: true,
            success: successFunc,
            error: errorFunc
        });
        function successFunc(data) {
            var firstName; //I'll need to set this variable with the name found in each row and assign that value to each Edit button attribute.
            $("#tblMyTable").DataTable(
                {
                    "info": true,
                    "data": data.list,
                    "responsive": true,
                    "autoWidth": false,
                    "bAutoWidth": false,
                    "retrieve": true,
                    columns: [
                        { 'data': "ID", }, 
                        { 'data': "First_Name" }, //This is the value I need. How can I set the value of the variable firstName using this data so that each button contains the attribute data-name with the value of the name column found in the current row?
                        { 'data': "Last_Name" },
                        { 'data': 'Edit', defaultContent: '<button type="button" data-name="' + firstName + '" href="javascript:;">Edit</button>' }

                    ]
                });

        }
        function errorFunc() {

        }
    }

在 columnDefs 中使用渲染函数对我有用。 columnDefs 应遵循 columns 选项:

"columnDefs": [
    {
        "targets": [3],
        "render": function (data, type, row, meta) {
            {
                return '<button type="button" data-name="' + row.First_Name + '" href="javascript:;">Edit</button>'
            }
        }
    }
]