Jquery Datatables : Jquery Popup Box not working u

2019-08-29 19:23发布

Hi i am using row details Link ... and i want A Simple JQUERY POPUP box ( which will show some details through php mysql ) under function format(d)

I have already one JQUERY popup on my 5 row please check under " columnDefs " with anchor tag -- this is working

and i want another JQUERY popup LINK popup or any other which would be in function format(d) -- but when i am using any simple popup ..the JQUERY popup is not working ... but the first one under " columnDefs " is working fine.

function format ( d ) {
    return 'Full name: '+d.first_name+' '+d.last_name+'<br>'+
        'Salary: '+d.salary+'<br>'+
        '<a href="">SECOND Another Popup</a>';
}

$(document).ready(function() {
    var dt = $('#example').DataTable( {
        "processing": true,
        "serverSide": true,
        "ajax": "scripts/ids-objects.php",
        "columns": [ 
            {
                "class":          "details-control",
                "orderable":      false,
                "data":           null,
                "defaultContent": ""
            },
            { "data": "first_name" },
            { "data": "last_name" },
            { "data": "position" },
            { "data": "office" }
          ],
       "columnDefs": [ 
                          {   
                            "aTargets":[5],
                            "mData": null, 
                            "mRender": function(data, type, full){
                             return '<div id="container"><a href="javascript: void(0);" class="click_'+full[0]+'">Click</a></div>';
                            }
                          }
                       ],
        "order": [[1, 'asc']]
    } );

    // Array to track the ids of the details displayed rows
    var detailRows = [];

    $('#example tbody').on( 'click', 'tr td:first-child', function () {
        var tr = $(this).closest('tr');
        var row = dt.row( tr );
        var idx = $.inArray( tr.attr('id'), detailRows );

        if ( row.child.isShown() ) {
            tr.removeClass( 'details' );
            row.child.hide();

            // Remove from the 'open' array
            detailRows.splice( idx, 1 );
        }
        else {
            tr.addClass( 'details' );
            row.child( format( row.data() ) ).show();

            // Add to the 'open' array
            if ( idx === -1 ) {
                detailRows.push( tr.attr('id') );
            }
        }
    } );

    // On each draw, loop over the `detailRows` array and show any child rows
    dt.on( 'draw', function () {
        $.each( detailRows, function ( i, id ) {
            $('#'+id+' td:first-child').trigger( 'click' );
        } );
    } );
} );

0条回答
登录 后发表回答