Add html attribute to datatable row on initializating

Add html attribute to datatable row on initializating

agustinbusagustinbus Posts: 5Questions: 2Answers: 0

How can i add an html attribute to datatable row when initializating?
I have my datatable on a modal, and i want to close the modal on row click. I use bootstrap AdminLTE template and i need to add the attribute "data-dismiss"="modal" to makeit work, and i don't know how!
Thank you in advace!

This question has an accepted answers - jump to answer

Answers

  • ignignoktignignokt Posts: 146Questions: 4Answers: 39
    Answer ✓
    var table = $('#example').DataTable({
        fnCreatedRow: function( nRow, aData, iDataIndex ) {
            $(nRow).attr('data-dismiss','modal');
        }
    });
    
  • agustinbusagustinbus Posts: 5Questions: 2Answers: 0

    Hi ignignkt! Thank you a lot, this code works perfectly! Thank you again!

This discussion has been closed.