Domanda

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?

È stato utile?

Soluzione

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

Altri suggerimenti

You need to use index() like,

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

See Demo

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top