onclick on an iPad?
onclick on an iPad?
mattgalvin
Posts: 2Questions: 0Answers: 0
I've got a datatable where I have tr click handler that is working fine on various browsers on a computer. On an iPad, the onClick doesn't fire. I've found information that points to a bug in the mobile Safari implementation as well as a workaround (http://blog.alanszlosek.com/post/4369588562/jquerys-live-click-handler-on-mobile-safari).
According to the workaround, I need the tr element to include [code]onclick=""[/code] in the rendered html, but I can't figure out how to get datatables to do that.
The datatables config is:
[code]
var aTable = $('#notifications').dataTable({
bProcessing: true,
bServerSide: true,
bLengthChange: false,
iDisplayLength: 10,
aoColumnDefs: [
{ "bVisible": false, "aTargets": [0] },
{ "bSearchable": false, "aTargets": [ 0, 1 ] },
{ "bSortable": false, "aTargets": [ 0, 2, 3, 4, 5 ] }
],
sAjaxSource: '/myURL'}'
});
$('#notifications tbody tr').live('click',function(event){
var aData = aTable.fnGetData(this);
var link = "/anotherURL/" + aData[0];
$.colorbox({
href:link,
iframe:true,
scrolling:false,
});
});
} );
[/code]
Can anyone help?
According to the workaround, I need the tr element to include [code]onclick=""[/code] in the rendered html, but I can't figure out how to get datatables to do that.
The datatables config is:
[code]
var aTable = $('#notifications').dataTable({
bProcessing: true,
bServerSide: true,
bLengthChange: false,
iDisplayLength: 10,
aoColumnDefs: [
{ "bVisible": false, "aTargets": [0] },
{ "bSearchable": false, "aTargets": [ 0, 1 ] },
{ "bSortable": false, "aTargets": [ 0, 2, 3, 4, 5 ] }
],
sAjaxSource: '/myURL'}'
});
$('#notifications tbody tr').live('click',function(event){
var aData = aTable.fnGetData(this);
var link = "/anotherURL/" + aData[0];
$.colorbox({
href:link,
iframe:true,
scrolling:false,
});
});
} );
[/code]
Can anyone help?
This discussion has been closed.
Replies
[code]
fnCreatedRow: function( nRow, aData, iDataIndex ) {
nRow.setAttribute("onclick", "");
},
[/code]
Allan