您可以使用数据表的fnRowCallback
选项添加自定义属性表中的行后,他们都创建(see the docs)。
$('#mytable').dataTable({
// Set data for the table here
// ...
// Add data attributes for intro.js
'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
if (aData[1] === 'Firefox 2') {
$('td:eq(1)', nRow)
.attr('data-intro', 'This column shows the browser type.')
.attr('data-step', '1');
}
},
// Add data attributes for sections, that do not belong to the table itself
'fnInitComplete': function(oSettings, json) {
// The number of elements selector seems to have the id of the table + '_length'
$('#example_length')
.attr('data-intro', 'Select the number of entries to show.')
.attr('data-step', '1');
}
});
http://jsfiddle.net/2f2L6/1/
来源
2014-03-03 20:57:07
Jan
什么是 “H1” 必须用数据表网格上市? – user2864740
这只是一个示例,表明您需要数据前奏和数据步骤选项 – James
但是*其中*是“h1”,*它如何与DataTable网格相关? “变更日志”与网格中显示的任何*数据有什么关系? – user2864740