0
jQuery DataTables reference顯示了一個將rowId
選項設置爲來自數據源(服務器端)的列的示例。此設置用於「選擇」擴展名和retaining row selection on Ajax reload。如何生成jQuery DataTables rowId客戶端?
是否有任何方法來生成行標識符值1)客戶端,或2)作爲來自數據源的多列的組合?
實例數據來源:
{
"data": [
{
"aid": 5421,
"bid": 4502,
"name": "John Smith"
}
}
代碼:
$("#datatable").DataTable({
select: true,
//rowId: "aid" each row ID is the value of the "aid" column
// e.g., <tr id="5421">
//rowId: 0 each row ID is the value of the 0-indexed column
// e.g., <tr id="5421"> (same as above)
rowId: [0, 1] // How? row ID combined value of 2+ columns
// e.g. <tr id="5421-4502">
rowId: "random" // How? random generated client-side ID
// e.g., <tr id="id34e04">
});