i am making a picker control and i want to get the value of first column of selected row from datatable, it works fine initially but when i use paging.,It does not works. Please suggest something. here is my code.
$(document).ready(function ()
{
$('#example').dataTable({"sPaginationType": "full_numbers","iDisplayLength": 10,});
$('#example tr').click(function ()
{
var queryString = window.location.search.substring(1);
if ($(this).find('th:first').attr('id') != "th")
{
window.opener.document.getElementById(queryString).value = $(this).find('td:first').text();
window.close();
}
});
});
Most probably the new elements are formed dynamically..try
$('#example').delegate('tr','click',function () {
var queryString = window.location.search.substring(1);
if ($(this).find('th:first').attr('id') != "th") {
window.opener.document.getElementById(queryString).value = $(this).find('td:first').text();
window.close();
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.