How to get the selected row in jquery datatables

0

I have my grid:

    $.fn.dataTable.ext.legacy.ajax = true;
    var grid = $("#gridGrupo").dataTable({
        "language": {
            "url": "/Scripts/Libs/DataTables/ptBr.txt"
        },
        "processing": true,
        "serverSide": true,
        "ajax": "/grupo/data",
        "order": [[0, "desc"]],
        "columns": [
            { "data": "Id" },
            { "data": "Nome", },
            { "data": "Descricao" }
        ]
    });
    $('#gridGrupo tbody').on('click', 'tr', function () {
        if ($(this).hasClass('row_selected')) {
            $(this).removeClass('row_selected');
        }
        else {
            grid.$('tr.row_selected').removeClass('row_selected');
            $(this).addClass('row_selected');
        }
    });

It arrows the "row_selected" class when it selects a row

I have my function

function Editar(){
}

I need to get the line that it has selected, which has the class "row_selectd" to get the Id, and if it does not find, send a msg

I'm not getting the part to select the Id ..

    
asked by anonymous 26.08.2014 / 19:17

1 answer

0

What I saw here is simple

using the following command to remove the line and can be adapted:

$('#button').click( function () {
        table.row('.selected').remove().draw( false );
    } );

If you need more help upload this part in jsfiddle to help a little more

    
26.08.2014 / 20:00