Làm cách nào để sửa đổi mã để hiển thị từng thông tin ô thành chú giải công cụ?Cách hiển thị đầu công cụ cho từng ô?
http://datatables.net/release-datatables/examples/advanced_init/events_post_init.html
$(document).ready(function() {
/*
* First step is to create title attributes for the rows in the table
* This isn't needed if the required 'title' attribute is already set in the HTML in the
* DOM
*/
$('#example tbody tr').each(function() {
var sTitle;
var nTds = $('td', this);
var sBrowser = $(nTds[1]).text();
var sGrade = $(nTds[4]).text();
if (sGrade == "A")
sTitle = sBrowser+' will provide a first class (A) level of CSS support.';
else if (sGrade == "C")
sTitle = sBrowser+' will provide a core (C) level of CSS support.';
else if (sGrade == "X")
sTitle = sBrowser+' does not provide CSS support or has a broken implementation. Block CSS.';
else
sTitle = sBrowser+' will provide an undefined level of CSS support.';
this.setAttribute('title', sTitle);
});
/* Init DataTables */
var oTable = $('#example').dataTable();
/* Apply the tooltips */
oTable.$('tr').tooltip({
"delay": 0,
"track": true,
"fade": 250
});
});
Yup. Và nếu nội dung của tooltip không có nghĩa là văn bản, bạn về mặt lý thuyết có thể lấy thông tin khác từ nơi khác (ví dụ, một thuộc tính data) bằng cách sử dụng về cơ bản cùng một kỹ thuật. –