Frage

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?

War es hilfreich?

Lösung

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

Andere Tipps

You need to use index() like,

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

See Demo

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top