click checkbox after filter
click checkbox after filter
Hokwang
Posts: 8Questions: 4Answers: 0
Hello.
It looks like a bug.
You can test below code.
Type "b_" in filter.
And then click the checkbox in row2 (b_2 line).
You will see alert popup 3 times. <- I think it is bug.
Thank you.
[code]
<!doctype html>
$(document).ready(function() {
$("table").dataTable({
"bAutoWidth": false,
"bJQueryUI": true,
"bSortClasses": false,
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"fnDrawCallback": function() {
$("input[type='checkbox']").click(function() {
alert($(this).parent("td").prev().text());
});
}
});
});
V
check
a_1
a_2
b_1
b_2
[/code]
It looks like a bug.
You can test below code.
Type "b_" in filter.
And then click the checkbox in row2 (b_2 line).
You will see alert popup 3 times. <- I think it is bug.
Thank you.
[code]
<!doctype html>
$(document).ready(function() {
$("table").dataTable({
"bAutoWidth": false,
"bJQueryUI": true,
"bSortClasses": false,
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"fnDrawCallback": function() {
$("input[type='checkbox']").click(function() {
alert($(this).parent("td").prev().text());
});
}
});
});
V
check
a_1
a_2
b_1
b_2
[/code]
This discussion has been closed.
Replies
Solution is easy: declare event listener outside Your table. See http://jsfiddle.net/Misiu/TtvKW/
[code]
$(document).on('click', "input[type='checkbox']", function () {
alert($(this).parent("td").prev().text());
});
[/code]
I didn't check that code, but is should work just fine :)