我正在使用带有这样一个复选框列的 YUI DataTable:
var myColumnDefs = [
{key:"check", label:'', formatter:"checkbox"},
{other columns...}
];
如何遍历已检查的所有行?
更新:
这是我目前的解决方法:
function getCheckedIds() {
var records = yuiDataTable.getRecordSet().getRecords();
var ids = '';
for (i=0; i < records.length; i++) {
var checked = false;
if (records[i] != undefined)
{
checked = $('#' + records[i].getId() + ' td div.yui-dt-liner input.yui-dt-checkbox').attr('checked');
if (checked) {
if (ids != '') {
ids += ',';
}
ids += records[i].getData("item.id");
}
}
}
return ids;
}