Kevin Murphy
Kevin Murphy

Reputation: 408

jQuery DataTables fnRender Increment Column

I'm trying to create a row inside my datatable that increments +1 each row. I've been told the easiest way to do this would be using fnRender. Now I've used fnRender to change data that's already in a column from the serverside processor, but never to create a new column alone.
Any help would be awesome!

Here's my current code:

oTable = $('#testingz').dataTable({
    "bProcessing": true,
    "bServerSide": true,
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "aaSorting": [ [1,'desc'] ],
    "sDom": '<""l>rt<"F"fp>',
        "sAjaxSource": "server_processing.php",
        "aoColumnDefs": [ 
            {
                "fnRender": function ( o, val ) {
                return '<a href="http://honedge.com/' + o.aData[0] + '">' + o.aData[0] + '</a>';
                },
                "aTargets": [ 0 ]
            }
        ]
});

Upvotes: 3

Views: 7222

Answers (1)

Allan Jardine
Allan Jardine

Reputation: 5473

Do you mean something like this: http://datatables.net/release-datatables/examples/api/counter_column.html

Upvotes: 1

Related Questions