How can I get the class, have two buttons in tag , how to know what button was clicking on ?

How can I get the class, have two buttons in tag , how to know what button was clicking on ?

leandrorcomleandrorcom Posts: 1Questions: 0Answers: 0
edited May 2015 in Free community support

Help me !

I have the same datatable with two buttons, how to solver ?

        oTablePedido = $('#table-pedido').DataTable({
            "retrieve": true,
            "iDisplayLength": 5,
            "order": [[0, "desc"]],
            "columnDefs": [
                { "targets": 0, 
                   "data": "id",
                   "render": function ( data, type, full ) {
                     return '<button class="btn btn-danger btn-xs fa fa-ban btn-cancelar" title"Cancelar" />'+
                            '<button class="btn btn-success btn-xs fa fa-credit-card btn-cartao" title"Cartão" />';
                }}                           
            ],  

Actions

     class .btn-cancelar

        $('#table-pedido tbody').on('click', 'tr', function () {
            var url = window.location.href;
            var id  = $('td', this).eq(1).text();
            ShowModal('Cancelar Pedido', url+"/cancelar_pedido/"+id);
        } ); 

        class .btn-cartao


        $('#table-pedido tbody').on('click', 'tr', function () {
            var url = window.location.href;
            var id  = $('td', this).eq(1).text();
            ShowModal('Cancelar Pedido', url+"_cartao/index/"+id);
        } );   

Awaiting!

Leandro Combinato

This discussion has been closed.