Events from a second table are not picked up.
Events from a second table are not picked up.
NobbyHall
Posts: 2Questions: 1Answers: 0
Hi,
I have two tables which are initialised. both have a on dblclick handler. The one on the first table works just fine however the events from the second never seem to make it to the handler.
Any help or advice would be welcome.
The two tables initialised:
var oTable = $("#search_results").dataTable({
select: true
});
var oRSSTable = $("#feed_items").dataTable({
select: true
});
The two events. The first works, the second does not:
$('#search_results').on('dblclick', 'tr', function(){
var oData = oTable.fnGetData(this);
alert(odata);
});
$('#feed_items tbody').on('dblclick', 'tr', function(){
var oData = oRSSTable.fnGetData(this);
alert(oData);
});
This discussion has been closed.
Answers
Having the same problem here.
Doing ".on( 'select', function ( e, dt, type, indexes )" on two tables. The second never enters when I click the rows (first one does).
Disabling the dataTable initialization on the first table "magically" enables the second table select to work.
Jouven, I found the same, removing the second table's initialisation allowed the event to fire. Trouble is I still need the table's reference/object via the event in order to grab the selected data. My jquery is rusty at best so I'm not sure if or how this issue can be gotten around.
Seems to work okay if I use your code in a little test case: http://live.datatables.net/doxifepa/1/edit .
Can you modify it to show the issue?
Allan
My apologies, but after more testing my problem has to do with deferLoading and the way I initialize the dataTable object... I already opened a discussion about it with a test case. Right now I don't know if it's exactly the same problem you have @NobbyHall.
For reference this is the discussion.