clicks on table rows do not register on iOS devices, simple example provided
clicks on table rows do not register on iOS devices, simple example provided
I am trying to get a callback when a row is clicked in a DataTable. I have a simple example that works in my desktop browser, and across various browsers on Android (e.g., Chrome, Web, Opera, Firefox). However, when trying the example on two iOS devices that I own, my clicks do not register on rows in the DataTable. I can click on the row headers just fine in iOS, but my data rows do not register clicks:
http://live.datatables.net/arofil
[code]
// Get clicks on table rows
$(document).on('click', '#example tr', function () {
var oTable = $('#example').dataTable();
var iPos = oTable.fnGetPosition(this);
alert("got a click");
if (iPos != null) {
var aData = oTable.fnGetData(iPos);//get data of the clicked row
alert("good");
}
});
[/code]
Does anyone see anything wrong in this simple example, and get the same behavior on their iOS device?
http://live.datatables.net/arofil
[code]
// Get clicks on table rows
$(document).on('click', '#example tr', function () {
var oTable = $('#example').dataTable();
var iPos = oTable.fnGetPosition(this);
alert("got a click");
if (iPos != null) {
var aData = oTable.fnGetData(iPos);//get data of the clicked row
alert("good");
}
});
[/code]
Does anyone see anything wrong in this simple example, and get the same behavior on their iOS device?
This discussion has been closed.
Replies
[code]
$('#example tbody').on( 'click', 'tr', function () {
[/code]
in place of the first line?
Allan
Allan