[英]Jquery, getting the column data of selected row using jtable
我的jtable中有3个字段; 名称,年龄,职业。假设我选择了特定的行,我将如何获取该行的特定列数据?
例如:
我选择以下行:第2行:25岁的乔·布朗,老师
我将如何获取该行的年龄数据(25岁)?
谢谢
PS:我打算删除该行,因此我需要正确查询sql数据库的名称(即使用jdbc)
$('#yourTable tr').each(function() {
var age = $(this).find("td").eq(1).html();
alert(age);// for testing purpose
});
您将获得第二行的值(索引从零开始)
var rowIndex = // the zero based index of the selected row
var age = $('.jtable tbody').children(rowIndex).children('td').eq(1).text(); // return the age
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.