문제

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?

도움이 되었습니까?

해결책

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

다른 팁

You need to use index() like,

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

See Demo

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top