datables.js,获取一行中传回的所有数据的方法:
columnDefs: [
{
"targets": 12,
"render": function (data, type, row, full) {
var rowJson = JSON.stringify(row);
str = '<button id="yhpc' + row.id + '" type="button" class="btn btn-info" style="">详情</button>';
return str;
}
}
],
"fnRowCallback": function (Row, Data, DisplayIndex, DisplayIndexFull) {
$("#yhpc" + Data.id, Row).bind("click", function () {
jump_pcinfo(Data);
});
}
为操作按钮设置id,用fnRowCallback方法获取该行的所有数据。
适用于数据字段较少的情形,数据量大的情况,建议使用传id,后台传值方式。