Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82109

fnRender renders all matching "mDataProp" columns

$
0
0
Hi,

I'm using Datatables 1.9.2 and am trying to implement an "actions"
column similar to this example:

http://www.datatables.net/forums/discussion/5862/creating-an-action-column-for-icons-view-edit-delete/p1

Here is my table initialisation:

$('.data-table').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "sDom": '<""l>t<"F"fpr>',
    "bProcessing": true,
    "sAjaxSource": "./data-subset.json",
    "aoColumns": [
        {"mDataProp": "id"},
        {"mDataProp": "date"},
        {"mDataProp": "user"},
        {"mDataProp": "status"},
        {
            "bSearchable": false,
            "bSortable": false,
            "mDataProp": "id",
            "fnRender": function(data) {
                return "hello" + data.aData["id"];
            }
        }
    ]
});

The markup:

<table class="data-table">
	<thead>
		<tr>
			<th>Date</th>
			<th>Uploaded</th>
			<th>Download</th>
			<th>Status</th>
			<th>Actions</th>
		</tr>
	</thead>
	<tbody>
	</tbody>
</table>

And some JSON:
{
        "sEcho": 2,
        "iTotalRecords": "2",
        "iTotalDisplayRecords": "2",
        "aaData": [
                {
                        "id": "1",
                        "date": "09/30/2012",
                        "user": "user1",
                        "status": "Active"
                },
                {
                        "id": "2",
                        "date": "06/03/2012",
                        "user": "user2",
                        "status": "Inactive"
                }
         ]
}

What's happening is that both the first "id" column and the "Actions"
column are being rendered. I would need to just show the id in the
first column, and the rendered one in the "Actions" column.

What am I doing wrong?

Cheers,
Alex

Viewing all articles
Browse latest Browse all 82109

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>