row clickable after ajax content

row clickable after ajax content

glucckglucck Posts: 5Questions: 1Answers: 0
edited August 2015 in Free community support

I'm new to the datatable, I compliment it is something fantastic.
Are three days that I'm banging my head unnecessarily without resolving my problem!

As the title I want
1) to receive data via ajax
2) write them in the table
3) make clickable new rows inserted

For the first two points I have no problem.
For the 3 I tried many solutions but no running, I actually much confusion in my head.

Some solutions are the following:

$(function(){
        $("#example").dataTable();
    })
    var oTable = $('#example').dataTable({
        "fnRowCallback": function (nRow, aData, iDisplayIndex) {

            // Bind click event
            $(nRow).click(function() {
                alert( 'You clicked on '+aData[2]+'\'s row' );

            });

            return nRow;
        }
    });

Or

$('#example tbody tr').click(function(event){
    alert($(this).text());
});

others say they use live or on.

Both work ONLY with the input code from html, in case I'm going to inject through ajax not working.

you can give me an example? in case you do need my code tell me what post ..

Please'm getting mad :-D

Answers

This discussion has been closed.