Detecting when a row is selected (single row)
Detecting when a row is selected (single row)
luisrortega
Posts: 79Questions: 6Answers: 1
Hi,
I'm looking to display information on a secondary div when a row is selected. Be aware that the data use ajax to retrieve data, therefore I can't use the...
[code]
$("#HomeSprintsT tr").click( function( e ) {
updateDiv(id);
});
[/code]
since tr is not created until data is received!
I also tried
[code]
"sAjaxSource": "Data.php?tbl=5&",
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
//Add Click event
nRow.click(function(e){
updateDiv(nRow.id);
});
}
[/code]
with no success...
I'm looking to display information on a secondary div when a row is selected. Be aware that the data use ajax to retrieve data, therefore I can't use the...
[code]
$("#HomeSprintsT tr").click( function( e ) {
updateDiv(id);
});
[/code]
since tr is not created until data is received!
I also tried
[code]
"sAjaxSource": "Data.php?tbl=5&",
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
//Add Click event
nRow.click(function(e){
updateDiv(nRow.id);
});
}
[/code]
with no success...
This discussion has been closed.
Replies
See also the top FAQ: http://datatables.net/faqs .
Allan
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
//Add Click event
$('#HomeSpritesT tbody').on( 'click', function (e) {
alert('delegate worked!');
});
}
[/code]
did not worked... nor
[code]
$(document).ready(function() {
$('#HomeSpritesT tbody').on( 'click', function (e) {
alert('delegate worked!');
});
[/code]
I suspect because the table is not created (or removed during a refresh)... should I try after the complete event of the table?
[code]
"fnInitComplete": function( nRow, aData, iDisplayIndex ) {
//Add Click event
$('#HomeSpritesT tbody').on( 'click','tr', function (e) {
alert('delegate worked!');
});
}
[/code]
with no success :(
Allan
email lortega@microkey.com
pass luis
section Home, then Sprints (left side)
file App.js and App.php
Typo - it should be:
[code]
$('#HomeSprintsT tbody').on( 'click','tr', function (e) {
[/code]
Sprints, not Sprites :-)
Allan
Thanks a lot Sir!