row().data() method not working.
row().data() method not working.
![adninjazz](https://secure.gravatar.com/avatar/9c41f725cf56be9d88f96ece7467f171/?default=https%3A%2F%2Fvanillicon.com%2F9c41f725cf56be9d88f96ece7467f171_200.png&rating=g&size=120)
I tried the code -
$('#NACH-User-Table').on( 'click', 'tr', function () {
var userId = table.row( $(this).parents('tr') ).data();
alert( "UserID = "+userId[0] );
} );
But getting UserID = undefined.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Actually, I want complete row data on click.
Hi @adninjazz ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
I think you should be able to use simply
this
to get the row:var userId = table.row( this ).data();
Kevin
Umm!!! Actually it worked when I changed this line -
alert( "UserID = "+userId[0] );
to
alert( "UserID = "+userId.UserID );
Its giving the info now.
Thanks for the help everyone.