Pergunta

Hello and thanks for helping me.

How can i get the currently selected row of my table? I need the number of this selected row, because i want to send it to the server

Look at this live example:

 http://live.datatables.net/qexevaj/7/edit

If i select a row and click on the button above the table the alert says ' Object object'. How can i solve this?

Foi útil?

Solução

try this:

$('#button').click( function () {
        alert($("#example tr.selected").index());
        alert($("#example tr.selected td:first-child").html());
 });

it will alert index started from 0.
live demo

Outras dicas

You need to use index() like,

var na = table.row('.selected').index();

See Demo

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top