[英]get the value of first column of selected row from datatable
我正在做一個選擇器控件,我想從數據表中獲取所選行的第一列的值,最初它可以正常工作,但是當我使用分頁時,它不起作用。 請提出一些建議。 這是我的代碼。
$(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();
}
});
});
新元素很可能是動態形成的..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();
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.