Passing value to custom column defaultContent

Passing value to custom column defaultContent

src0010src0010 Posts: 7Questions: 2Answers: 0

I am instantiating my table as follows:

   $(document).ready(function () {
        var table = $('#example').DataTable({
            "ajax": "Content/datatableJson.txt",
            "columns": [
                {
                    "className": 'details-control',
                    "orderable": false,
                    "data": null,
                    "defaultContent": '<i class="fas fa-plus-square"></i>'
                },
                { "data": "PageID" },
                { "data": "PageTitle" },
                { "data": "UserName" },
                { "data": "Email" },
                { "data": "Rating" },
                { "data": "CommentDate" },
                { "data": "Approved" },
                {
                    "className": '',
                    "orderable": false,
                    "data": null,
                    "defaultContent": '<input type="checkbox" name="xID" value="">'
                }
            ],
            "order": [[1, 'asc']]
        });

My question is in the last column defaultContent how would I pass the next data field to the input value? For example the next data entry coming from json would be ("data": "CommentID")...I would like to populate the input value with that value.

Thanks in advance!

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.